• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GC pros and cons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC pros and cons


  • Subject: Re: GC pros and cons
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 24 Jun 2009 13:00:51 -0500

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).


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.

b.bum

_______________________________________________

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


  • Follow-Ups:
    • Re: GC pros and cons
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: GC pros and cons (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: extending NSSavePanel, how to disable <save> button?
  • Next by Date: Re: UML Diagramming or Other Helpful Software
  • Previous by thread: Re: GC pros and cons
  • Next by thread: Re: GC pros and cons
  • Index(es):
    • Date
    • Thread