Re: real authority on what needs to be released
Re: real authority on what needs to be released
- Subject: Re: real authority on what needs to be released
- From: Dietrich Epp <email@hidden>
- Date: Wed, 11 Sep 2002 13:11:49 -0700
On Wednesday, September 11, 2002, at 09:43 , James DiPalma wrote:
From: Dietrich Epp <email@hidden>
Autorelease pools are to free things from methods other than those
made with alloc/init.
NSAutoreleasePools do _not_ free anything and they do way more than
release objects that where not "made with alloc/init" *. When they are
dealloced, they simply send release to objects that received an
autorelease message. NSObject's release method will decrement its
retainCount by 1; if this objects retainCount now equals 0, this object
will call dealloc on itself. NSObject's dealloc method will free its
own memory.
* All objects are made with an alloc/init... method somewhere, so by
your statement, NSAutoreleasePool does nothing. Good thing Apple has
clearly defined what NSAutoreleasePool does by writing documentation
(the first paragraph):
I'm not a bonehead, I just explained things more simply than you can
tolerate. Next time just point the guy to the documentation and quit
harassing those who give explanation a shot.
Basically you own anything you alloc/init, copy, or retain. Then you
release it when you're done. If you don't own it, it's probably been
autoreleased. When the autorelease pool is deallocated, objects in it
will be released too - basically a delayed release.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.