memory management alloc release
Let's say an array allocated with some objects/images and are to be used throughout the application life, and if I don't use release in dealloc method, will those objects continue to remain in memory in spite of perma开发者_如何学运维nent exit of the application? or does ios releases all memory used by the application after terminating it.
From the documentation for -[NSObject dealloc]
:
Important: Note that when an application terminates, objects may not be sent a
dealloc
message since the process’s memory is automatically cleared on exit—it is more efficient simply to allow the operating system to clean up resources than to invoke all the memory management methods. For this and other reasons, you should not manage scarce resources in dealloc—see “Object Ownership and Disposal” in Memory Management Programming Guide for more details.
So the objects do not remain in memory when the application exits — the operating system automatically reclaims the memory used by the application.
精彩评论