O'Reilly logo

Objective-C Recipes: A Problem-Solution Approach by Matthew Campbell

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    8

Memory Management

This chapter explores how to manage memory with Objective-C.

The recipes in this chapter will show you how to:

  • Understand memory management
  • Use reference counting to manage memory
  • Use Automatic Reference Counting (ARC) to manage memory
  • Use garbage collection (GC) to manage memory on the Mac

8.1 Understanding Memory Management

Problem

You want to understand how to manage memory effectively in your Objective-C applications.

Solution

Memory is one of the finite resources that your Objective-C application requires. Every variable and object that you use in Objective-C takes up some memory. Since memory is a finite resource, it’s possible to use up all the memory that you have available.

Programmers who work in C-based ...

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