Consider the following program:
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// Insert code here...
NSLog(@"Programming is Fun !");
[pool drain];
return 0;
}
I don't understand why pool
is needed there as the same program can be also written as this:
int main (int argc, const char * argv[]) {
NSLog(@"Programming is Fun !");
return 0;
}
What is a purpose of using an auto release pool? Why and when do we need them? Are they mandatory in every objective C program?
If i don't want to auto release any object, do I also need to use an Auto Release pool ?