Strong vs Weak Reference in Cocoa

Standard

In iOS we always end up defining our instance variables as  @property (strong) or @property(weak). But what does strong and weak mean, and when to use which one?

In cocoa, an objects memory is managed via a system called retain count. When an object is initialized, its retain count is increased by 1 from zero. And each time it is strongly referenced by someone, the retain count keeps increasing by 1. In ARC (a compile time feature of Apple’s version of automated memory management, acronym of Automatic Reference Counting), it only frees up memory for objects when there are zero strong references to them, or simply put, the retain count is zero.

Continue reading