Skip to content

Memory Management in iPhone

June 23, 2010

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…

Advertisements

From → iPhone

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: