Welcome to the Treehouse Community
Looking to learn something new?
@property strong vs weak
So, I get the retain count. to my understanding is just something that keeps track of the memory allocated for a variable. If I create a NSString with a strong attribute I know my retain count goes up to one. But realistically speaking what does this mean? Can people expand on this idea
Mike Baxter4,442 Points
You'll probably save yourself a lot of headache if you avoid thinking in terms of retain count. The "strong" and "weak" memory types are really meant to help you avoid thinking about retain count. Instead, you should think in terms of ownership, of strong and weak.
A strong memory reference means ownership of an object.
A weak memory reference means no ownership of an object.
And you have a big problem when two objects own one another. How can they own one another? If they each have a strong reference to one another, then they are said to own one another. (This is called a "strong retain cycle", or "retain cycle" for short.) It means that neither of the objects can ever get deleted because ARC thinks they still have an owner—and we know that only things without owners get deleted. You're perfectly fine having as many things as you'd like be owners of an object (in other words, to have a strong reference to an object), but you shouldn't ever have a case where you have a retain cycle.