#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
The main method calls release on the pool after the application exits, which incidentally sends release to all objects in the pool. But because autoreleased objects created inside the application don't stick around until the application exits, at some point during the runloop, the pool is either drained or released (in the context of iPhone, drain==release.. unless I need to be corrected on this point!). But does anybody know for certain when this happens? It would seem logical for the pool to be drained at the end of a runloop, and a new one to be alloced at the beginning of the next, but I can't find any definitive information on this. Here's a discussion on the apple forums, but it seems highly speculative (not to mention contentious, towards the end). Can anyone give me an answer, ideally with evidence from documentation or source code (or even an experimental program)?