Re: Debugging complex autorelease/release/retain issue
Re: Debugging complex autorelease/release/retain issue
- Subject: Re: Debugging complex autorelease/release/retain issue
- From: "Philip Q" <email@hidden>
- Date: Mon, 20 Nov 2006 14:25:47 +1300
On 20/11/06, Skip Haughay <email@hidden> wrote:
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?
When an autorelease pool is dealloc'd, it will send a release message
to every object in the pool (for each time it has been put in the
pool). It will not do any other strange manipulation of the release
count.
When the autorelease pool has finished, the retain count of the object
will simply be the reduced by the number of times it was added to the
pool (this might be 0, it might not, it depends on how many other
retains were sent to the object). The autorelease pool does not
"clean" out any object (if you mean it dealloc's them), that's handled
by NSObject independently of the pool.
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.
The autorelease pool doesn't play a part in this, when the retain
count of an object reaches 0, dealloc will be called on it.
I don't know if dealloc is guaranteed to be called immediately, during
the release, or at some point in the future.
-Phil
_______________________________________________
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