Mac OS X Reference Library Apple Developer
Search

Introduction

In any program you write, you must ensure that you manage resources effectively and efficiently. One such resource is your program’s memory. In an Objective-C program, you must make sure that objects you create are disposed of when you no longer need them.

In a complex system, it could be difficult to determine exactly when you no longer need an object. Cocoa defines some rules and principles that help making that determination easier.

Important: In Mac¬†OS¬†X¬†v10.5 and later, you can use automatic memory management by adopting garbage collection. This is described in Garbage Collection Programming Guide. Garbage collection is not available on iOS.

Who Should Read This Document

You should read this document to learn about the object ownership policies and related techniques for creating, copying, retaining, and disposing of objects in a reference-counted environment.

Note: If you are starting a new project targeted at Mac¬†OS¬†X¬†v10.5 and later, you should typically use garbage collection unless you have good reason to use the techniques described here.

This document does not describe details of allocating and initializing objects, and implementing initializer methods. These tasks are discussed in “Allocating and Initializing Objects” in The Objective-C Programming Language.

Organization of This Document

This document contains the following articles:




Last updated: 2010-06-24

Did this document help you? Yes It's good, but... Not helpful...