• 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: [Leopard] Debugging GC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Leopard] Debugging GC


  • Subject: Re: [Leopard] Debugging GC
  • From: mmalc crawford <email@hidden>
  • Date: Mon, 29 Oct 2007 17:33:16 -0700


On Oct 29, 2007, at 5:10 PM, Chris Hanson wrote:

So what is the correct idiom now?

The correct idiom is now (following my own style, sorry):

- (id)somethingFromCarbon {
   CFFooReference foo = CFCopyFooWithBar(5);

   return [NSMakeCollectable(foo) autorelease];
}

Since a couple of people have said the same thing now, I think it may be worth pointing out that they're looking at this from the perspective of a framework developer who has to write mixed-mode code (code that has to support both managed memory and garbage collected environments).

For application developers, I'll reiterate Bill's earlier comments:

Choose either GC or non-GC and stick with your choice. The implementation of your somethingFromCarbon method would then look like:

- (id)somethingFromCarbon {
   CFFooReference foo = CFCopyFooWithBar(5);

   return NSMakeCollectable(foo);
}


(NSMakeCollectable takes a CFTypeRef as a parameter.)

mmalc

_______________________________________________

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: [Leopard] Debugging GC
      • From: Alastair Houghton <email@hidden>
References: 
 >[Leopard] Debugging GC (From: Pierre Bernard <email@hidden>)
 >Re: [Leopard] Debugging GC (From: Bill Bumgarner <email@hidden>)
 >Re: [Leopard] Debugging GC (From: John Stiles <email@hidden>)
 >Re: [Leopard] Debugging GC (From: mmalc crawford <email@hidden>)
 >Re: [Leopard] Debugging GC (From: John Stiles <email@hidden>)
 >Re: [Leopard] Debugging GC (From: mmalc crawford <email@hidden>)
 >Re: [Leopard] Debugging GC (From: glenn andreas <email@hidden>)
 >Re: [Leopard] Debugging GC (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: Collection was mutated while being enumerated
  • Next by Date: Re: Collection was mutated while being enumerated
  • Previous by thread: Re: [Leopard] Debugging GC
  • Next by thread: Re: [Leopard] Debugging GC
  • Index(es):
    • Date
    • Thread