Child object retention with NSOutlineView
Child object retention with NSOutlineView
- Subject: Child object retention with NSOutlineView
- From: Scott Ahten <email@hidden>
- Date: Sun, 30 May 2004 17:06:42 -0400
I apologize if this is a simple question. All of the research and
examples I've looked at have yet to provide a solution.
I'm having memory management problems with an NSOutlineView. My data
source is wrapped around a XMLTree object, which contains a valid XML
document.
My application crashes unless I retain the item returned in
outlineView:child:ofItem:. Returning the item auto-released seems to be
insufficient. When I call childAtIndex on the XMLTree, a new XMLTree
object is created from a CFXMLTreeRef and returned auto-released.
Since I can't tell when the outline view is done with the item, I don't
know when to release it. In addition, the outline view calls this
method very often, which means every update creates a object, most
likely leading to a memory leak.
I've thought of caching the child objects returned by the XMLTree and
only returning a new child items when the child is not found in the
cache, but I'm guessing that no cache hits will occur since the XMLTree
will always return new objects, even for the same child.
Thanks in advance,
- Scott
- - - - -
:: email@hidden
::
http://www.pixelfreak.net
- - - - -
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.