4 Memory Management
All of the objects and values that your app uses take up memory. When those objects and values are no longer needed, you want the system to reclaim that memory it so that it can be reused.
Memory management in Cocoa is relatively simple. For instances of value types, there is nothing to worry about. The memory is immediately reclaimed as soon as the variable goes out of scope or when the reference type that it is part of (e.g., a property is a part of an object) is itself reclaimed.
As reference types, objects are much more interesting because their lifetimes are not tied to scope. Objects frequently live longer than the methods in which they are created. Cocoa uses reference counting to manage their lifetimes. ...
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide 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.