• 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: glenn andreas <email@hidden>
  • Date: Mon, 29 Oct 2007 14:18:16 -0500


On Oct 29, 2007, at 1:34 PM, mmalc crawford wrote:


On Oct 29, 2007, at 11:26 AM, John Stiles wrote:

Well, with GC, retain counts are not needed, since objects are not collected by their retain counts but rather by when they are unreferenced. So there's no real problem per se. No actual memory leaks.
But if CFRetain(obj) will bump a refcount, while [obj release] will fail to decrement it, it seems like it will be a common problem that objects will have incorrect refcounts when they are collected.


CFRetain and -retain are no longer symmetrical, as are not CFRelease and -release...


It is perfectly legal to adjust a toll-free-bridged object's refcount using either the CF calls (which work) or the NSObject calls (which no-op).

... you should balance CFRetain with CFRelease. That's it.


It use to be that if you called a CFCopy style routine, you could return the result via autorelease, something like:

- (id) getSomethingFromCarbon
{
	CFFooReference cffoo = CFCopyFooWithBar(5);
	return [(id)cffoo autorelease];
}

(assuming CFFooReference was one of the bridged objects).


So what is the correct idiom now?


Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next generation of fractal art




_______________________________________________

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: Chris Hanson <email@hidden>
    • Re: [Leopard] Debugging GC
      • From: Bill Bumgarner <email@hidden>
    • Re: [Leopard] Debugging GC
      • From: "Clark Cox" <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>)

  • Prev by Date: Figuring out Interface Builder 3.0
  • Next by Date: Re: How to make Redo work with a custom group
  • Previous by thread: Re: [Leopard] Debugging GC
  • Next by thread: Re: [Leopard] Debugging GC
  • Index(es):
    • Date
    • Thread