Summary of Manual Memory Management Rules
Here are some rules to remember when working with a project compiled without ARC or garbage collection:
If you need to hold on to an object to make sure it doesn’t get destroyed by someone else, you should retain
it. Make sure to release
the object when you’re done with it.
Sending a release message does not necessarily destroy an object. When an object’s reference count is decremented to 0, the object is destroyed. The system does this by sending the dealloc
message to the object to free its memory.
Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.