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: Shawn Erickson <email@hidden>
- Date: Tue, 31 Aug 2010 09:54:10 -0700
On Tue, Aug 31, 2010 at 9:45 AM, David Duncan <email@hidden> wrote:
>
> 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*).
To backup what David states review...
<http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html>
_______________________________________________
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