How does the NSAutoreleasePool autorelease pool work?

Yes, your second code snippit is perfectly valid. Every time -autorelease is sent to an object, it is added to the inner-most autorelease pool. When the pool is drained, it simply sends -release to all the objects in the pool. Autorelease pools are simply a convenience that allows you to defer sending -release until “later”. … Read more