Re: Newbie question: autorelease sends autorelease
Re: Newbie question: autorelease sends autorelease
- Subject: Re: Newbie question: autorelease sends autorelease
- From: j o a r <email@hidden>
- Date: Wed, 22 Sep 2004 08:44:10 +0200
I don't know how this is implemented. I would guess (a), or perhaps (b)
- but very unlikely (c).
I would be interested to know why it matters to you though? Are you
tracking down leaks? I would view this as an implementation detail for
Apple to worry about...
If you're curious I think that you could use +showPools from NSDebug.h
to figure out how it is handled.
j o a r
On 2004-09-22, at 05.25, James Bucanek wrote:
First question: What happens to an object that gets autoreleased
during the dealloc message of another object that is being released by
an autorelease pool?
Example:
Object a retains object b.
Object a gets autoreleased.
When the NSAutoreleasePool gets dealloc'd, a gets released.
The dealloc handler for a sends an autoreleas to b.
What happens to b?
(1) b gets added to the same NSAutoreleasePool that a belongs to, and
that NSAutoreleasePool repeatedly releases objects until it is empty.
(2) b gets added to some other (next higher?) autorelease pool.
(3) b leaks.
_______________________________________________
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