Hi,
Very recently my application that uses an UltraTree started consuming vast resources. I have found that a single node object when part of a heirarchy will consume upwards of 50KB.
Furthermore if I add the root node object to a tree control's nodes collection, clearing the tree's node collection (using nodes.clear() ) does not release the references to the nodes. This means if you build a tree, then clear it's nodes and try to rebuild it, you will be holding two full trees in memory. At upwards of 50KB per node, this will bring a system to it's knees when you are working with trees containing thousands of nodes.
The same project used to consume far less resources prior to upgrading to 2011.1. Can you please advise?
I have attached a simple project that procedurally generates a tree as an example (using 2011.2 where the problem still exists).
Thanks.
I ran your sample, but there doesn't appear to be any code in it for tracking the amount of memory usage. How are you determining the memory usage? Are you using a memory profiler? Or are you relying on the Windows Task Manager.
I would strongly advise against using the TaskManager, as it will not give you an accurate portrayal of the memory usage for a DotNet application, since it does not account for Garbage collection.
There is also nothing in your sample that disposes of the nodes or the tree control, so I don't see how this sample could demonstrate that the the nodes.Clear method is not releasing the resources.
And since your sample generates a random number of nodes each time, it's impossible to make any comparison between one version and the next.
So on what are you basing the claim that the tree uses more memory in the latest version?
Hi Mike,
I found a development server running VS2008 and NetAdvantage v9.1. I created the same project and found that the tree uses only ~100MB when loaded once (compared to the ~500MB). Rebuilding the tree will start releasing memory after the second click, and the overall memory usage of the application doesn't exceed ~200MB.
I have attached the application here.
I can rewrite the application to generate a fixed number of nodes, but you can see the number doesn't vary from ~10500 nodes too much, and comparing these two applications should be enough.
Let me know if you need anything else.
Thanks
Thanks for the response. No there is no code for tracking memory usage. I am basing my statements on the fact that building the tree once will consume ~500MB of data, and clearing and rebuilding the nodes will result in the application consuming ~1GB of data (yes, as reported by Task Manger). I did run the project in ANTS memory profiler only to find the vast majority (>98%) of memory usage was consumed in 'unmanaged' memory.
I do not explicitly dispose of the nodes, but I shouldn't have to. I don't retain any references to the nodes, so the GC should free the memory as new requests for memory come in. It is simple to see the memory not being released by clicking '(re) build tree' more than once. Each time it is clicked the tree's node collection is cleared and it is assigned a new node hierarchy. If the resources for the nodes were released the memory usage should not grow linearly as it does with each click. Every time the tree is rebuilt it consumes ~500MB more memory. After the third or forth click (depending on platform) dotNET starts throwing random exceptions because the application hits the virtual memory ceiling.
If you have some method that will force the tree to release the resources used for previous node collections, I am happy to try this.
I do not have data to corroborate my statement about the new version using more memory. I simply had an application that worked fine in VS2008 with an older version of NetAdvantage and it stopped working due to memory usage in VS2010 and the latest NetAdvantage.
I may be able to get back to the previous version of NetAdvantage and create the same project using older controls to highlight the issue. I'll see if I can get the old VMs started up to accomplish this.