Re: GC pros and cons
Re: GC pros and cons
- Subject: Re: GC pros and cons
- From: Marcel Weiher <email@hidden>
- Date: Wed, 24 Jun 2009 22:38:22 -0700
On Jun 24, 2009, at 11:00 , Bill Bumgarner wrote:
On Jun 24, 2009, at 12:51 PM, Quincey Morris wrote:
In a nutshell, for folks like me who regularly use CFCreate …
CFRelease in loops, what are the benefits of GC?
If CFCreate/CFRelease is precisely what you want to do, there are
no benefits from GC, because the garbage collector isn't involved.
Similarly, if you regularly use alloc/init ... release in loops,
there are no benefits from using autorelease instead of release (in
a non-GC app, I mean).
However, if the lifetime of the object you CFCreate is not strictly
internal to the loop, then using (in a GC app) CFMakeCollectable
once instead of futzing with CFRelease in multiple paths of
execution might simplify your code greatly.
There are actually some performance downsides to using CFRetain/
CFRelease in Leopard that grow to a greater significance in Snow
Leopard. In Snow Leopard, this includes short lived objects like
the temporaries that may be CFCreate'd/CFRelease'd in a tight loop
(obviously, I can't disclose what those changes are -- if you are
curious, post a question to devforums.apple.com).
Hmm...this part of the answer indicates a generic downside...
Specifically, you are effectively disabling the Collector's ability
to do collection work, including object reclamation and
finalization, concurrently with the execution of code that actually
does work.
...whereas this part talks specifically about the collector. Is there
a downside in SnowLeopard to CFRetain/CFRelease when not using the
collector?
Marcel
_______________________________________________
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