Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Objective-C under iOS doesn’t have a garbage collector and instead uses a mechanism called reference counting. That involves keeping up with how many references there are to an object, and only freeing it up when the count drops to zero (it’s no longer being used). You can think of this as object-ownership. An object can have more than one owner, and as long as it has at least one, it continues to exist. If an object doesn’t have any owners left (its retain count hits 0), it’s freed and cleaned up.
When using properties, the compiler handles it for us. The properties we’ve declared so far have all used the retain attribute. When the compiler generates a setter for that property, it will properly handle memory management for us, like this: