Chapter 9. Garbage Collection

Garbage object collection is most notable for what you, the programmer, don't have to do. In a perfect world, you just ignore the mechanics of garbage collection and let the run time system take care of the details. But there are situations when you do need to pay attention to garbage collection. Weak references and finalize methods require some understanding of what causes objects to become garbage and how they get collected.

Garbage collection in Objective-C 2.0 is broadly similar to what you experience in Java. Most of the time, you simply forget about it and "just works." Objective-C's garbage collector is on a par with modern Java implementations. It's a conservative, multi-generational, garbage collector that ...

Get Learn Objective-C for Java Developers 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.