Skip to content

Instantly share code, notes, and snippets.

@rustle
Created May 25, 2012 19:13
Show Gist options
  • Save rustle/2789971 to your computer and use it in GitHub Desktop.
Save rustle/2789971 to your computer and use it in GitHub Desktop.
Before @autoreleasepool a fairly common pattern in a try catch would be the following
NSAutoreleasePool *aPool = [[NSAutoreleasePool alloc] init];
@try {
}
@catch (NSException *anException) {
}
@finally {
[aPool drain];
}
I believe the theory being that you try to clean up what you can in the @finally even though you would likely still leak some objects.
With @autoreleasepool there doesn't seem to be a way to do this:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool
Is it fair to say that the drain in the old style was more handwaving than helpful or is @autoreleasepool worse in this regard than the object version?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment