objective-ccocoansoperationnsautoreleasepoolnsblockoperation

NSBlockOperation and NSAutoreleasePool


Normally when you create an NSOperation subclass you are responsible for creating and releasing an NSAutoreleasePool in the -main method.

When you use an NSBlockOperation, do you need to create an autorelease pool in the block?


Solution

  • No. GCD (which NSOperationQueue is built on top of as of OS X 10.6 or iOS 4.2) manages autorelease pools for you, the same way that NSRunLoop does.