Re: can you autorelease toll-free bridged types
Re: can you autorelease toll-free bridged types
- Subject: Re: can you autorelease toll-free bridged types
- From: David Duncan <email@hidden>
- Date: Tue, 31 Aug 2010 09:45:58 -0700
On Aug 31, 2010, at 9:34 AM, Roland King wrote:
> Of course I now have to ask if I *were* doing it .. what's the issue?
Under GC -retain, -release, -autorelease and -retainCount are no-ops (objc_msgSend doesn't even dispatch them).
> Is it that autorelease doesn't do anything so the CF type never gets the CFRelease() call it would do from a real -release? What does CFMakeCollectable() do if you are memory managed .. nothing? These are things I've not had to worry about but you piqued my interest.
CFMakeCollectable() does nothing under Retain/Release and calls CFRelease() under GC. The typical idiom for dual mode code is to do "[NSMakeCollectable(foo) autorelease]" which will ensure the object will be released under both RR and GC (NSMakeCollectable is identical to CFMakeCollectable except for its return value being id instead of void*).
--
David Duncan
_______________________________________________
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