Understanding Exceptions and Handlers in Cocoa
Subject:   Making your programs exception-safe
Date:   2007-08-07 22:39:02
From:   DavidPhillipOster
Response to: Making your programs exception-safe


NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self doSomeWork]; // may raise
[pool release];

is already exception safe. Sure if a raise happens, the [pool release] won't get called, but it turns out that NSAutoreleasePools aren't like other objects: they manage a chain, and when an earlier one NSAutoreleasePool released, it makes sure that all the later ones are cleaned up, too. So, don't bother with @try{}@finally{} guards on your NSAutoreleasePools.
-- David Phillip Oster