From iPhone Development Wiki
Revision as of 09:44, 2 February 2017 by Testatest (talk | contribs)

The NSAutoreleasePool class is a thin wrapper around the NSPushAutoreleasePool and NSPopAutoreleasePool functions.

#ifdef __cplusplus
extern "C" {
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus


static void MyMethod()
    void *pool = NSPushAutoreleasePool(0);
    [[[NSObject alloc] init] autorelease];

The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.