• 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: Michael Ash <email@hidden>
  • Date: Sun, 28 Jun 2009 19:40:24 -0400

On Sun, Jun 28, 2009 at 7:33 PM, Peter Duniho<email@hidden> wrote:
> Maybe I'm misreading one, or the other, or both of your messages, but it
> seems to me that what Quincy wrote is in agreement with what you quoted.
>
> In particular, my (admittedly inexperienced) understanding is that an object
> winds up "in the garbage collected zone" when code calls CFMakeCollectable.
>  Conversely, "GC-unaware code" would not, I would think, call
> CFMakeCollectable (that seems like a very "GC-aware" thing to do, right?).

"NULL, kCFAllocatorDefault, and kCFAllocatorSystemDefault specify
allocation from the garbage collection zone.

"By default, all Core Foundation objects are allocated in the garbage
collection zone."

And while we're at it, CFMakeCollectable doesn't do *anything*
magical, all it does is call CFRelease under GC, and assert that the
object is in the right zone. If you know that you're running under GC
and that the object will be in the garbage collected zone, it is
*identical* to CFRelease:

"Better still, though, you can use CFMakeCollectable instead of
CFRelease. CFMakeCollectable calls CFRelease, but has two
supplementary features: first, it halts the program if the object
wasn't allocated in the scanned zone; second, it’s a no-op in a
reference counted environment."

Doesn't take any experience, just a bit of reading. I'd recommend that
all participants in this thread read the Garbage Collection
Programming Guide top to bottom before continuing any further....

Mike
_______________________________________________

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: mmalc Crawford <email@hidden>
References: 
 >Re: GC pros and cons (From: Graham Cox <email@hidden>)
 >Re: GC pros and cons (From: Bill Bumgarner <email@hidden>)
 >Re: GC pros and cons (From: James Gregurich <email@hidden>)
 >Re: GC pros and cons (From: Michael Ash <email@hidden>)
 >Re: GC pros and cons (From: Bill Bumgarner <email@hidden>)
 >Re: GC pros and cons (From: Michael Ash <email@hidden>)
 >Re: GC pros and cons (From: Quincey Morris <email@hidden>)
 >Re: GC pros and cons (From: Michael Ash <email@hidden>)
 >Re: GC pros and cons (From: Peter Duniho <email@hidden>)

  • Prev by Date: Re: GC pros and cons
  • Next by Date: Re: GC pros and cons
  • Previous by thread: Re: GC pros and cons
  • Next by thread: Re: GC pros and cons
  • Index(es):
    • Date
    • Thread