O'Reilly logo

Objective-C Fundamentals by Collin Ruffenach, Johannes Fahrenkrug, Christopher K. Fairbairn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Memory management

 

This chapter covers
  • Object lifetime management
  • Manual memory management via retain and release messages
  • Autorelease pools and the autorelease message
  • Object ownership rules
  • Memory management rules for custom classes

 

Many developers new to Objective-C find memory management one of the most difficult concepts to wrap their heads around. This is especially true for those coming from an environment such as Java, .NET, ActiveScript, or Ruby, where memory management is a much more automated, behind-the-scenes process.

In Objective-C all objects are created on the heap (unlike languages such as C++, which also allow objects to be placed on the stack). This means objects continue to consume memory until they’re ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required