[cfe-dev] Automatic Reference Counting for Objective-C

Chris Lattner clattner at apple.com
Wed Jun 15 14:36:41 PDT 2011


[resending for the mailing list archive]

Hi All,

I'm happy to say that we just pushed the Clang implementation of Automatic
Reference Counting (ARC) for Objective-C into the public
http://clang.llvm.org repository, including the low-level ARC migration tool.

ARC provides automated memory management for Objective-C programs that is
compatible with existing retain/release code.  ARC is carefully built to
be a reliable programming model that errs on the side of producing a
compiler error instead of silently producing a runtime memory problem.
ARC automates Objective-C objects, not malloc data, file descriptors,
CoreFoundation datatypes or anything else.

In addition to ARC, this code also includes compiler support for Zeroing Weak
References, which build on top of ARC to provide a language feature useful
for breaking retain cycles.

For more detail than you probably want about ARC, please check out the spec:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html

While this is mostly useful for people with access to previews of iOS5 or 
Mac OS X Lion (which provide the necessary runtime support for ARC) and 
Xcode 4.2 (which provides high level tools), we encourage you to take a look,
play with it, report bugs etc.  If you have feedback or proposals for how to
change the model, please familiarize yourself with the spec before making
wild new suggestions :)

If you're a registered Apple developer, ARC is now considered a public feature
of Clang (also known as "Apple LLVM Compiler" in Xcode), so it can be discussed
publicly.  However, interactions with other prerelease features of iOS5 or Lion
are considered confidential until those products launch, so please refrain from
disclosing non-ARC details.  Thanks!

-Chris



More information about the cfe-dev mailing list