FROM : Adam Thorsen
DATE : Fri Jan 11 18:58:51 2008
At various points throughout the execution of my app, I need to
refresh the data displayed in an NSBrowser with completely new data.
I have an NSBrowser(@millerBrowser) bound to an NSTreeController
(@treeController), which is in turn bound to an array of NSTreeNodes
(@remoteTree).
This is basically how I've been doing it (tree is the new data,
@remoteTree is the old data):
@remoteTree and tree are both NSArrays containing NSTreeNodes.
(@remoteTree removeAllObjects)
(tree each:(do (branch)
(@remoteTree addObject:branch)))
(set currentPath (@millerBrowser path))
(@treeController rearrangeObjects)
(@millerBrowser setPath:currentPath)
I've found that the problem with this is that it creates a HUGE memory
leak (2MB per shot). How can I safely replace the data without
causing a huge memory leak? Keep in mind that this is written in Nu,
which is garbage collected using reference counting, so all I have to
do is make sure the data in @remoteTree is no longer referenced.
Is there perhaps someway to remove the data through the
NSTreeController?
DATE : Fri Jan 11 18:58:51 2008
At various points throughout the execution of my app, I need to
refresh the data displayed in an NSBrowser with completely new data.
I have an NSBrowser(@millerBrowser) bound to an NSTreeController
(@treeController), which is in turn bound to an array of NSTreeNodes
(@remoteTree).
This is basically how I've been doing it (tree is the new data,
@remoteTree is the old data):
@remoteTree and tree are both NSArrays containing NSTreeNodes.
(@remoteTree removeAllObjects)
(tree each:(do (branch)
(@remoteTree addObject:branch)))
(set currentPath (@millerBrowser path))
(@treeController rearrangeObjects)
(@millerBrowser setPath:currentPath)
I've found that the problem with this is that it creates a HUGE memory
leak (2MB per shot). How can I safely replace the data without
causing a huge memory leak? Keep in mind that this is written in Nu,
which is garbage collected using reference counting, so all I have to
do is make sure the data in @remoteTree is no longer referenced.
Is there perhaps someway to remove the data through the
NSTreeController?
| Related mails | Author | Date |
|---|---|---|
| Adam Thorsen | Jan 11, 18:58 | |
| Kyle Sluder | Jan 11, 23:49 |






Cocoa mail archive

