Hi Friends,

We will have a series of articles on memory management in the days ahead. And as a primer I would give you the basics of memory management  in iPhone Development.

Now let’s get in to the topic.

We may be aware of the fact that resources must be managed effectively and it applies to memory also. So the rule of thumb is to ensure that objects you have created are disposed when they are no longer necessary.

Memory Management in objective -C (cocoa-Touch)can be better understood when we know about Object Ownership. This

What is Object Ownership?

You become owner of an object when either

  • you create an object by using a method whose name begins with alloc or new.
  • you create an object by using a method which contains a keyword copy.
  • you send an object a retain message.

What should you do when you become owner of an object? You have to give up your control over that particular object using either release or autorelease . You have no rights to relinquish control over objects that you don’t own.

Lets meet with the next article…