On Aug 5, 2009, at 8:11 PM, Marco S Hyman wrote:

I assume that just because I can toll-free bridge something
between core foundation and NSFoo I still have to worry about
CFretain/CFrelease in a GC app.  Correct?

Correct.

Example:

Assume image is an CGImageSourceRef.

   NSDictionary *metadata =
        (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(image, 0, NULL);
   ....
   CFRelease((CFDictionaryRef) metadata);

or alternately

   NSDictionary *metadata = (NSDictionary *)
NSMakeCollectable(CGImageSourceCopyPropertiesAtIndex(image, 0, NULL));

Is that correct?

Either will work. You are better off using NSMakeCollectable() as it the collector is then free to reap the object at its convenience. As well NSMakeCollectable() offers more opportunity for future optimizations than does CFRelease().

b.bum

_______________________________________________

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