问题
With last version of iOS Apple has implemented Automatic Reference Counting for Objective-C, but I don't understand as works.
回答1:
Automatic reference counting inserts retain and release messages into your code for you at compile-time, following the normal conventions. So it's exactly as if you did the memory management yourself manually, except that the compiler is smart enough to be able to write that bit for you, and much less likely to make a mistake.
So it's not garbage collection, it's more like a (very simple) form of static analysis. And you still get overwhelmingly deterministic memory management and little overall change in runtime costs, as per the caveats raised by Catfish_Man below.
回答2:
Automatic Reference Counting implements automatic memory management for Objective-C objects and blocks, freeing the programmer from the need explicitly insert retains and releases. It does not provide a cycle collector; users must explicitly manage lifetime instead.
Read this spec - Automatic Reference Counting
来源:https://stackoverflow.com/questions/7756006/does-automatic-reference-counting-work-as-garbage-collector