Re: Cocoa-dev Digest, Vol 4, Issue 123
Re: Cocoa-dev Digest, Vol 4, Issue 123
- Subject: Re: Cocoa-dev Digest, Vol 4, Issue 123
- From: Antonio Nunes <email@hidden>
- Date: Thu, 8 Feb 2007 00:35:30 +0000
On Feb 8, 2007, at 8:13 AM, Tiger wrote:
hello everyone, I am learning the objective-C language, there is
some concept that really makes me feel puzzled.
What is the difference between [release] and [dealloc]? Both of
them seem to release a instance object, when should I use them ?
I really cant tell the difference from one to one.
In my understanding, and put very succinctly:
-[release] is what you use to tell the runtime you are no longer
interested in an object. It does not necessarily tear down the object.
-[dealloc] is something you never call yourself, but that gets called
on an object by the runtime when it's retain count reachers zero. You
override it in your own objects to make sure they release any objects
they may be retaining at deallocation time.
Make sure you read up on objc memory management:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
index.html>
Cheers,
António
----------------------------------------------------
There is a world of difference between
searching for happiness and choosing
to be happy.
----------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden