Re: I think I am leaking! :)
Re: I think I am leaking! :)
- Subject: Re: I think I am leaking! :)
- From: Andrew Platzer <email@hidden>
- Date: Sat, 27 Oct 2001 17:43:43 -0700
On Saturday, October 27, 2001, at 02:33 , Steven W. Riggins wrote:
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 :)
I'm surprised that you get an AllocationEvent and an
ObjectAutoreleasedEvent but no subsequent actual release. It's as though
the autorelease pool isn't being freed. This should happen each time you
return from handling an event in NSApplication. I looked through the
NSURL and NSHTTPURLHandle and didn't see any obvious leaks.
Thanks for the reply. I moved the entire test into a controller in the
main nib. It only shows allocations now, no autoreleases, nothing.
In fact, there are *two* leaks. The aforementioned NSHTTPURLHandle and the
NSData that it returns. The NSHTTPURLHandle because its dealloc routine
neglects to call [super dealloc] and the NSData which is allocated but not
autoreleased before being returned.
Thanks for finding them. I've filed bugs on both of them.
As for workarounds, the NSData leak isn't too bad though you should check
version numbers since I'm sure we'll fix it for the next release. For the
NSHTTPURLHandle, that's more difficult. If this is for an application that
you want to ship, please contact me and we can figure something out. I
have to talk to the owner of the code about these problems.
Andrew
__________________________________________________________________
A n d r e w P l a t z e r
A p p l i c a t i o n F r a m e w o r k s
A p p l e