A beginner question here.
My goal: to understand the design rationale behind this.
When I created a Command Line tool project that links against Foundation class, xcode generated the following code snippet.
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
I have some general idea of the functionality of NSAutoreleasePool. But I do not understand why we need NSAutoreleasePool here: in such a simple program, when main() finished, all alloc'd objects will be released anyway.
Is there other reason/advantage of having NSAutoreleasePool here?