What are the consequences of omitting @autoreleasepool { } in main()?
What are the practical consequences of omitting @autoreleasepool { ... }
in main() of a command line program?
These two pieces of code compile and seem to work equivalently:
1.
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSLog(@"Hello, World!");
}
return 0;
}
2.
int main(int argc, const char * argv[])
{
NSLog(@"Hello, World!");
return 0;
}
I suspect that the theoretical consequences are that the second version
can leak memory. I want to know why.
No comments:
Post a Comment