O'Reilly logo

Objective-C Memory Management Essentials by Gibson Tang, Maxim Vasilkov

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

How ARC looks

Start by picturing a traditional Objective-C source code file written by an expert Cocoa programmer. The retain, release, and autorelease messages are sent in all the right places and are in perfect balance.

Now, imagine editing the source code file, removing every instance of the retain, release, and autorelease messages, and changing a single build setting in Xcode that instructs the compiler to put all the suitable memory management calls back into your program when the source code is compiled. That's ARC. It's just what the name suggests—traditional Cocoa reference counting, being automatically done.

At its core, ARC is not a runtime service; it doesn't work on program execution, as Garbage collection does. On the other hand, the ...

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