Newbie question: autorelease sends autorelease
Newbie question: autorelease sends autorelease
- Subject: Newbie question: autorelease sends autorelease
- From: James Bucanek <email@hidden>
- Date: Tue, 21 Sep 2004 20:25:23 -0700
Greetings,
I'm a fairly new to Cacoa programming and am in the process of creating my first major application. I've got a few basic memory management questions that I can't seemed to find the answers to in the documentation.
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.
Thanks,
James
--
James Bucanek <mailto:email@hidden>
_______________________________________________
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