Debugging complex autorelease/release/retain issue
Debugging complex autorelease/release/retain issue
- Subject: Debugging complex autorelease/release/retain issue
- From: Skip Haughay <email@hidden>
- Date: Sun, 19 Nov 2006 17:12:59 -0800
Hey all:
I have a leak in my code I am attempting to chase down, and in doing so, I need some clarification of the behavior of autorelease pool objects. In order to debug my class memory cycle, I overrode the following:
+ (id) alloc // Added NSLog to indicate object allocation to console
- (void) dealloc // Added NSLog to indicate object deallocation to console
- (id)retain // Added NSLog to indicate retain call, plus show the retainCount to console
- (void)release // Added NSLog to indicate release call, plus show the resulting retainCount
I have an object that is alloc'ed, and then autoreleased. The class which requested the new object then retains it. There is an indeterminate sequence of retains and releases that occurs as this object is shared among several other objects.
At the end of it all, the object SHOULD be going away via the autorelease. But it doesn't seem that the dealloc method is EVER invoked. Indeed, after the last release, the retainCount is still 1.
But what I am curious about is, when the autorelease pool is dumped, is the retainCount of the object decremented at THAT point, or should it be zero after the last release, and the release of the autorelease pool will clean it out if it is zero? Furthermore, when an object is dumped from disposing of the autorelease pool, the dealloc for that object SHOULD be called, right? I am setting a breakpoint therein, and it isn't happening.
Thanks,
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden