On Aug 1, 2011, at 5:51 PM, Wade Tregaskis wrote: >>> Any code that throws exceptions will probably leak a few objects, since >>> according to the ARC design doc the ABI requires not draining autorelease >>> pools while unwinding the stack. >> >> Are you sure (or does ARC work differently)? >> >> <http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html>: > > That'll need to be updated. If you look at the @autoreleasepool section of > the ARC documentation, it specifically states that crossing out of one via an > exception will not drain the pool. There doesn't appear to be any way, even > through compiler flags, to change this.
If an autorelease pool pop is skipped by an exception, then the autorelease pool will not be drained immediately. However, it will generally be drained later, after the exception is caught and handled and some parent pool itself is drained normally. @autoreleasepool is no different from NSAutoreleasePool here. http://sealiesoftware.com/blog/archive/2008/09/16/objc_explain_Exceptions_and_autorelease_pools.html (There is a bug in SnowLeopard and Lion: if an NSAutoreleasePool drain is skipped, then the pool's contents are cleaned up later as described, but the NSAutoreleasePool object itself may leak. @autoreleasepool fixes this small leak if your deployment target is Lion, because it never allocates the NSAutoreleasePool object in the first place.) -- Greg Parker gpar...@apple.com Runtime Wrangler _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com