On Nov 10, 2008, at 11:04, Michael Link wrote:
The documentation for propertyListFromData:mutabilityOption:format:errorDescription: says that errorDescription needs to be released by the caller. In a garbage collected environment is this still the case? Should NSMakeCollectable() be called on errorDescription?
No, because it's a Cocoa data type (NSString*), you don't have to handle it specially. The only time you have to worry about it is for those very few Cocoa methods that return an object of CF data type (and for objects returned by non-Cocoa functions, of course).
This may seem strange because most common Cocoa and CF objects are toll-free bridged -- are, in fact, identical types. The difference is that the memory management is an attribute of the object, not the type. Objects returned as Cocoa types have slightly different memory management semantics.
Is it safe to call NSMakeCollectable() multiple times on the same object (when in doubt)?
It's absolutely not safe. NSMakeCollectable does a CFRelease on the object, which really decrements its retain count, even when garbage collection is in use. (Under garbage collection, CFRelease is not a no- op like 'release' is.)
_______________________________________________ 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 [EMAIL PROTECTED]