Tuesday October 25, 2011

Automatic Reference Counting

Great summary from Mike Ash on Automatic Reference Counting (ARC). Contrary to what many have speculated on Twitter, ARC is not garbage collection like we’re used to. Objects don’t stay alive until some other thread comes along at runtime looking to see what is no longer needed. ARC is still about retain and release…it’s just that the compiler does all the work to manage that for you. In essence, it inserts retain, release and autorelease at method and object boundaries at compile time.

Why? It’s faster. It’s more deterministic. The system doesn’t have to search for and syncrhonize object deallocation across threads anymore. There are a couple of edge cases that you’ll need to be aware of, but for the most part it works without any special intervention from you.

Still confused? That’s why Mike’s summary is so great. Read up on this. It is the future of Apple platform development.