views:

147

answers:

2

I created an NSOperation. Do I also need to create an autorelease pool for this or is it all handled for me like voodoo black magic?

+2  A: 

The NSOperation may run on any thread, so yes, you must set up your own autorelease pool for the work being done.

Mike
+2  A: 

You do need to create autorelease pool yourself in the NSOperation main method, if the environment doesn't support automatic garbage collection.

notnoop
Wait... what? Never should the words "autorelease pool" and "automatic garbage collection" appear in the same sentence. The two are completely different. This makes no sense.
bbum
You just put them in one sentence ;-). When running in the garbage collection mode, you don't need the autorelease pool; and if you aren't running in garbage collection mode, then you need to manage your own memory, possibly by using autorelease pools. What doesn't make sense about this?
notnoop