Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
- Subject: Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
- From: Jens Alfke <email@hidden>
- Date: Thu, 1 Oct 2009 08:42:35 -0700
On Sep 30, 2009, at 7:37 PM, Adam R. Maxwell wrote:
Does the Cocoa memory management documentation cover functions? It
specifically refers to "...a method whose name begins with...". I
wonder if something like the CF "Create" rule applies to Foundation?
No — Foundation functions almost never return references that you need
to release. The only exceptions I can think of are a few low-level
functions intended to be used for custom object allocation/copying,
like NSAllocateObject and NSCopyObject.
The reason for CF's "Create" and "Copy" naming rule is that CF doesn't
have autorelease, so functions that might return newly-created objects
have no choice but to hand the responsibility to the caller.
—Jens_______________________________________________
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