Who Should Read This Document?
Organization of This Document
See Also
In Mac OS X version 10.5, the Cocoa programming environment is enhanced with automatic memory management—commonly known as "garbage collection." The "traditional" system of memory management (using retain, release, and autorelease pools)—herein referred to as “reference counted”—coexists both for binary compatibility with existing programs as well as for those that choose to not make use of the new facility. Garbage collection is hence an opt-in system.
These documents describe the complete garbage collection system provided for Cocoa, the functionality provided, and some of the issues that arise if you adopt this technology.
If you are developing applications using Cocoa, you should read at least “Garbage Collection for Cocoa Essentials” to gain an understanding of the garbage collection system. It is strongly recommended that you also read “Adopting Garbage Collection” and “Implementing a finalize Method.” You are expected to already understand the Objective-C language (see The Objective-C 2.0 Programming Language) and to have some familiarity with Cocoa.
The following articles explain the problems the garbage collection system addresses, the solutions it provides, its basic functionality, and common tasks you might perform:
“Garbage Collection for Cocoa Essentials” describes the essential details of the garbage collection system for Cocoa. At a minimum, you should read this article.
“Adopting Garbage Collection” describes issues related to adopting garbage collection.
“Architecture” describes the design goals and architecture of the technology, and the benefits you get from using it.
“Using Garbage Collection” describes some of the features you can take advantage of when you use garbage collection, and some of subtleties you need to be aware of.
“Implementing a finalize Method” describes how to correctly implement a finalize
method.
“Inapplicable Patterns” describes Cocoa programming patterns that are not applicable to garbage collection.
“Using Core Foundation with Garbage Collection” describes how to use Core Foundation objects with garbage collection.
“Garbage Collection API” provides a summary of API used in garbage collection.
The following documents provide information about related aspects of Cocoa and the Objective-C language.
The Objective-C 2.0 Programming Language describes object-oriented programming and describes the Objective-C programming language.
Objective-C 2.0 Runtime Reference describes the data structures and functions of the Objective-C runtime support library.
Memory Management Programming Guide for Cocoa addresses Cocoa's object-ownership policy for manual memory management and related techniques for creating, copying, retaining, and disposing of objects.
Garbage Collection Release NotesâMac OS X v10.5.0 provides information about the current release of the technology.
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-11-19)