• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Releasing NSSearchPathForDirectoriesInDomain causes crash


  • Subject: Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Thu, 01 Oct 2009 19:28:07 -0700


On Oct 1, 2009, at 8:42 AM, Jens Alfke wrote:


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.

As I pointed out last night, NSCreateMapTable/NSCreateHashTable return references that you need to free, as well (as does NSCreateZone). The NSCreateFile... functions evidently follow a "get" rule, as does NSSearchPathForDirectoriesInDomain.


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.

Right, I understand that. It just seems to me that there's no meaningful naming convention for Foundation functions with respect to memory management.



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Re: Releasing NSSearchPathForDirectoriesInDomain causes crash (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: reading (parsing) CSV (or Excel) data
  • Next by Date: Re: [Enigmatic semi-solution] Re: Cannot get pixel color from NSBitmapImageRep
  • Previous by thread: Re: Releasing NSSearchPathForDirectoriesInDomain causes crash
  • Next by thread: Re: How to tell if NSArrayController has a selected CoreData instance?
  • Index(es):
    • Date
    • Thread