5. Memory Management

Memory management is an important concept in any object-oriented language, such as Objective-C. Understanding the specifics of any language’s memory-management model is vital to being able to write memory-efficient, bug-free code.

Once you understand the rules, memory management in Objective-C is not complicated and was made easier when Automatic Reference Counting (ARC) came along. ARC diverts nearly all the memory-management decisions to the compiler, leaving you to concentrate on the business logic.

Item 29: Understand Reference Counting

Objective-C uses reference counting for memory management, meaning that every object has a counter that is incremented and decremented. You increment the counter when you want to register ...

Get Effective Objective-C 2.0: 52 Specific Ways to Improve Your iOS and OS X Programs 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.