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? Of the following "Create" functions

NSCreateMapTable
NSCreateZone
NSCreateHashTable
NSCreateFileContentsPboardType

the first 3 you obviously own...but I'm not sure about the last one. You're definitely correct that the result of NSSearchPathForDirectoriesInDomains should not be released, but I'm not sure the rules for functions are clear.

-- adam

On Sep 30, 2009, at 7:18 PM, Graham Cox wrote:

Yes, because it's not yours to release.

RTFMMGA:        
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-BEHDEDDB


--Graham



On 01/10/2009, at 12:07 PM, Anthony Smith wrote:

Does anybody know why releasing the NSArray obtained from NSSearchPathForDirectoriesInDomain causes my iPhone app to crash? Here's my code:

+ (NSString *)dataFilePath:(NSString *)filename {
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *directory = [paths objectAtIndex:0];
        
        [paths release];
        
        return [directory stringByAppendingPathComponent:filename];

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/amaxwell%40mac.com

This email sent to amaxw...@mac.com

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

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to