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 ...
Get Objective-C Recipes: A Problem-Solution Approach 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.