Calvin's

Icon

designs and hacks. people and products.

Memory Management: Autorelease Pools

An autorelease pool is an instance of NSAutoreleasePool and defines a scope for temporary objects.  These temporary objects are added into the current autorelease pool when we send them an autorelease message or we have created them using a convenience method.  When the autorelease pool is released, all the temporary objects added into it are automatically released.  This, of course, is much simpler than manually releasing individual objects which were created by alloc or retain!

Autorelease pools can be nested which means that autorelease objects are added to the latest autorelease pool to be created.