Understanding memory management
09/04/2010 § 3 Comments
It is well known that iOS developers deal with memory management everyday, although a lot of them didn’t really get the “reference counting” idea. That is why it is better to talk about ownership instead of counting.
In fact, the memory management concept in iOS is all about an object ownership schema, that is implemented through reference counting. Basically when no one owns an object, that object reference counting reaches 0 and therefore it is deallocated.
As you probably are an iOS developer, you already know that Objective-C provides some methods like alloc, new, retain, copy, release and autorelease to deal with that counting. But the real question here is when to use them.