Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will the -dealloc method be called upon application quit?

Apple says, that in Cocoa -dealloc will not be called neccessarily when the application quits. Does this also apply to the iPhone?

like image 937
Thanks Avatar asked Nov 24 '25 06:11

Thanks


1 Answers

Yes, it does. If the application is quitting, under certain circumstances, dealloc will not be called. If, for example, anything in applicationWillTerminate takes too long or throws an uncaught exception, the application will quit without calling dealloc.

It may be that it never calls dealloc on quit, since the OS does the memory cleanup anyway. The simplest and quickest solution to find out would be to put a breakpoint on the dealloc of your main view controller and see if it's called on application quit.

I think I remember it wasn't called when I tried this once, but I'm not sure, which is why you should try it yourself.

like image 140
Ed Marty Avatar answered Nov 26 '25 23:11

Ed Marty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!