On Nov 16, 2009, at 1:50 PM, Clark Cox wrote: > Though, if you're planning on returning an > autoreleased object, you're already assuming that there is an > autorelease pool in place, in which case, there is no need to wrap the > local function in your own pool.
> You wouldn't want to wrap such a > method in an autorelease pool at all; whether or not that pool is tied > to the method scope is largely irrelevant at that point. There are reasons to have a local autorelease pool even if you know there is already an autorelease pool in an outer scope. If you need to return an object from your inner pool to a caller, you retain it, release/drain your inner pool, and then re-autorelease the object before returning it. With the C++ RAII approach, you'd have to put the StackAutoreleasePool() macro inside a block and put your return outside of it. Regards, Ken _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
