Re: When to 'release' in Cocoa management?
Re: When to 'release' in Cocoa management?
- Subject: Re: When to 'release' in Cocoa management?
- From: DairyKnight <email@hidden>
- Date: Fri, 21 Aug 2009 20:46:55 +0800
Thanks for the link. Guess it explains. So every call without alloc/new,
e.g. [NSMutableString stringWithString], you dont have to release the
objects yourself?
On Fri, Aug 21, 2009 at 6:34 PM, Graham Cox <email@hidden> wrote:
>
> 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