Re: Memory management question
Re: Memory management question
- Subject: Re: Memory management question
- From: Wade Tregaskis <email@hidden>
- Date: Thu, 25 Mar 2004 11:23:08 +1100
(The -retain increments the reference count, removing it from the
autorelease pool, then the -release triggers the deallocation of the
object.)
This is the first I've ever heard that retain removes an object from
the autorelease pool. How does it know that the object is even *in* an
autorelease pool? And which pool? More info please.
I'm pretty sure they are mistaken. Retaining an object doesn't remove
it from any autorelease pools it's in.. if it did, each retain would be
worth 2 or more retains, so you'd leak gratuitously.
You could, I suppose, search all available autorelease pools for the
object, and only if it's not in one actually increment it's retain
count, but there are numerous problems with this, not the least of
which is performance and trying to ensure you check every pool.
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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.