Re: When to 'release' in Cocoa management?
Re: When to 'release' in Cocoa management?
- Subject: Re: When to 'release' in Cocoa management?
- From: Graham Cox <email@hidden>
- Date: Fri, 21 Aug 2009 20:34:03 +1000
On 21/08/2009, at 5:42 PM, bryscomat wrote:
Yes. You release the object when one of three things occur:
1. You allocate the object yourself with the "alloc" message.
2. You allocate the object yourself with the shorthand "new" message.
3. You issue a retain message.
So in both examples you gave you are required to release the object,
as you are responsible for it because you explicitly allocated it.
This list is incomplete.
We're not supposed to rehash the memory management rules on the list,
as invariably, they are incorrect or incomplete. What we are supposed
to do is provide a link (yet again) to the rules:
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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