IPhone memory management: no need to clean up and release leftover objects when closing an app?

Is the following true?

When an application is about to exit, it is not required to clear memory by triggering a release on all of your saved objects, because the iPhone OS will return the memory allocated to your application when you launch it. It's faster and safer than relying on apps to clean up properly after themselves. You can test this by placing an NSLog call (or debugger breakpoint) in your delegate application's dealloc method and seeing that it never called.

So, cleaning things up when the app is about to quit is useless. What's more, you have very limited time until the OS wipes out your application, so don't waste that cleaning things up. Focus on saving your game and any other relevant stuff.

Source (cocos2d-iphone.org)

+2


source to share


1 answer


Yes. Quoting the documentation :



Important: when the application exits, objects cannot be sent with a dealloc message from the process, the memory is automatically cleared out - it is more efficient to simply let the operating system clean up resources than to invoke all the memory management methods. These are implications for how you implement the dealloc method - see Resource Management.

+4


source







All Articles