What is ARC?
Automatic Reference Counting, the Automatic Reference Counting, that is, ARC, is the biggest change and most exciting change introduced by WWDC2011 and iOS5.
ARC will automatically help you add retain and release/autorelease statements.
ARC compilers are divided into (1) Front-end compilers (2) Optimizers
(1) Front-end compiler-insert a corresponding release statement for each "owned" object. ---- An object is created in a method. The front-end compiler will automatically add the release statement at the end of the method to destroy it. ---- Objects (instance variables/attributes) owned by the class are released in the dealloc Method
(2) ARC optimizer-when multiple repeated calls to retain and release appear in the Code, the ARC optimizer is responsible for removing redundant retain and release statements.
If you want to hold an object, send a retain to it. If you don't use this object any more, you need to send a release (or autorealse) to it, mutable copy or new call (automatic reference count + 1), one call of release or autorealse (automatic reference count-1 ).