Re: NSTreeController and object retain counts
Re: NSTreeController and object retain counts
- Subject: Re: NSTreeController and object retain counts
- From: Graham Cox <email@hidden>
- Date: Mon, 9 Nov 2009 22:38:31 +1100
On 09/11/2009, at 10:31 PM, Mads Paulin wrote:
Adding a node object through this method creates a node object in the
document array member with a retain count of 2. The remove:sender
method
correctly removes the object from the document's array but only
decrements
the node object's retain count to 1 - meaning that the objects are
never
dealloc. As I see it, this is a memory leak in NSTreeController as
all "my"
external references to the Node objects are lost.
You can't meaningfully debug by peeking at retain counts. Instead try
logging from the -dealloc method if possible, or use the leaks
Instrument to find out if the objects are really not being
deallocated. There's no requirement that the retain count is actually
decremented to 0 - the code may merely predict that it would be and
call -dealloc, rather than actually doing it.
--Graham
_______________________________________________
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