• 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 07:39:27 -0400

On Sat, Jun 27, 2009 at 9:47 PM, Bill Bumgarner<email@hidden> wrote:
> On Jun 27, 2009, at 8:38 PM, Michael Ash wrote:
>>
>> (And I only say "almost" because I can only assume there's a corner
>> case out there somewhere with CoreFoundation-using code, since CF
>> objects are also garbage collected, but I am not actually aware of
>> any.)
>
> When a CF object is created, it is CFRetain()ed and, thus, the collector
> will ignore it.  If it is then managed entirely through a balanced set of
> CFRelease() and CFRetain() calls, it'll work just like it does under non-GC.
>
> If you call CFMakeCollectable(), that'll effectively balance the CFRetain()
> at creation while making the collector aware of the object.
>
> Thus, no real edge case here (as designed).

Right, but once you do the final CFRelease and the retain count hits
zero, objects in the default zone aren't destroyed, but merely become
eligible for collection. This modifies their lifetimes and may cause
their destruction code to run at a different time and in a different
context. This could conceivably cause trouble for CF containers with
custom callbacks that were built with the assumption that they would
run synchronously with the final CFRelease.

(Of course they should not *have* such assumptions, but that doesn't
mean they won't.)

Or did I misunderstand something?

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: Quincey Morris <email@hidden>
References: 
 >Re: GC pros and cons (From: James Gregurich <email@hidden>)
 >Re: GC pros and cons (From: WT <email@hidden>)
 >Re: GC pros and cons (From: Graham Cox <email@hidden>)
 >Re: GC pros and cons (From: WT <email@hidden>)
 >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>)

  • Prev by Date: Re: Bonjour over the web
  • Next by Date: Re: UITextView symbols
  • Previous by thread: Re: GC pros and cons
  • Next by thread: Re: GC pros and cons
  • Index(es):
    • Date
    • Thread