Does dealloc get called on iPhone? Does dealloc get called on iPhone? objective-c objective-c

Does dealloc get called on iPhone?


The docs say that it is more efficient for the operating system to reclaim the memory all at once than for the application to slowly relinquish all of its chunks of memory. For this reason, dealloc may not be sent to a vast number of objects; and for this reason it is important not to manage scarce resources in dealloc. To clean up scarce resources it is probably a better idea to have your application delegate respond to applicationWillTerminate: and do your cleanup in there.

- (void) applicationWillTerminate:(NSApplication/UIApplication *) anApp{    [scarceResourceManager relinquishScarceResources];}


As dreamlax already said, the system reclaims all memory as soon as the application exits. So there is no use for the application to call dealloc when quitting. It's standard behaviour on Mac OS X, and I doubt it will be different on an iPhone - simulated or "real".