I have a question about the autorelease,now I have the code below:
int main(int argc, char *argv[]){
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}}
the doc says at the end of the @autoreleasepool{} the object marked as autorelease will receive a release message. but the UIApplicationMain never return ,which means the flow will never get to the end of the @autoreleasepool then the object marked as autorelease will never get release until the app die. There has no meaning of autorelease.....
I asked someone who says that the iOS system will generate some threads,(you know,one thread,one runloop).he says that the runloop will create the autorelease pool.so the autorelease object will release at the end of the thead or runloop. But the most situation we use the main thread.so what he says doesn't persuade me.
what's the proper time to use autorelease.It confused me a long time.
I get another point that the autorelease object will get release when one runloop end(the main runloop will exist all the app's life??) so I'm not sure..
any point and related document will be appreciated!!
exit()
, so any memory will be returned to the operating system anyway. – borrrden