Re: [Leopard] Debugging GC
Re: [Leopard] Debugging GC
- Subject: Re: [Leopard] Debugging GC
- From: Jon Hess <email@hidden>
- Date: Mon, 29 Oct 2007 13:16:35 -0700
On Oct 29, 2007, at 11:36 AM, John Stiles wrote:
On Oct 29, 2007, at 11:34 AM, 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.
If the semantics of these calls and/or their legality in various
contexts has changed, I guess this is the first I've heard of it.
I guess that makes sense since I'm not planning on adopting GC in
the near future ;)
I think mentioning CFMakeCollectable/NSMakeCollectable is appropriate
here. Those methods help you transition an object with CFRetain
semantics into a context that would normally -[NSObject release] it
while taking garbage collection into consideration.
Jon Hess
_______________________________________________
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:
@mac.com
This email sent to email@hidden
_______________________________________________
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