• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
I think I am leaking! :)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I think I am leaking! :)


  • Subject: I think I am leaking! :)
  • From: "Steven W. Riggins" <email@hidden>
  • Date: Sat, 27 Oct 2001 01:48:59 -0700

Hi Folks,

After 2 days of archive searching, doc reading, emailing friends, I am confused. My first real Cocoa app appears to be leaking memory from NSHTTPURLHandles created by NSURL. Here is a method I wrote:

- (void)leakTest
{
NSURL *lURL;
NSData *lData;
int count;
int loop;

for (loop = 0; loop <= 50; loop++)
{
lURL = [[NSURL alloc] initWithString:[[self mSettings] mURL]];
if (!lURL)
goto releaseMem;

lData = [lURL resourceDataUsingCache:NO];
if (!lData)
goto releaseMem;

releaseMem:
[lURL release]; // no longer needed
}
return;
}


I call this from windowDidLoad in my NSWindowController subclass.

When looking at my app with ObjectAlloc, I see 51 NSHTTPURLHandles. Looking in the instance browser tab, I see two events per instance, an AllocationEvent and an ObjectAutoreleasedEvent, but no release/dealloc.

This is boiled down from my larger issues, but trying to find out how I should be releasing the data from the NSURL has become an obsession :)

Thanks!

Steve

P.S. 2 all niters, I am running out of Code Red, so the help is appreciated, lol


  • Follow-Ups:
    • Re: I think I am leaking! :)
      • From: Andrew Platzer <email@hidden>
  • Prev by Date: Re: I'm just leaking, darn it...
  • Next by Date: Calling a CLI command withing the app
  • Previous by thread: [ANNOUNCE] Image-A-Gogo v1.0b1
  • Next by thread: Re: I think I am leaking! :)
  • Index(es):
    • Date
    • Thread