
Automatic Reference Counting (ARC)
How ARC Works
Every time you create a new instance of a class, ARC allocates a chunk of memory to store information about that instance.
When an instance is no longer needed, ARC frees up the memory used by that instance so that the memory can be used for other purposes instead.
Whenever you assign a class instance to a property, constant, or variable, that property, constant, or variable makes a strong reference to the instance. The reference is called a "strong" reference because it keeps a firm hold on that instance, and doesn't allow it to be deallocated for as long as that strong reference remains.
Strong Reference Cycles Between Class Instances
It’s possible to write code in which an instance of a class never gets to a point where it has zero strong references. This can happen if two class instances hold a strong reference to each other, such that each instance keeps the other alive. This is known as a strong reference cycle.
You resolve strong reference cycles by defining some of the relationships between classes as *weak* or *unowned* references instead of as strong references.