We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Has anyone noticed a Mem. leak using treeView control in C#?

I have created a C# MDI app that launches multiple instances of child forms containing a treeView control. I populate the tree completely when the form loads and Memory increases about 10MB per instance of the form. On closing the child windows, the memory does not get recovered, even after calling GC.Collect(). After an hour my app is > 200MB. Any ideas? Help!!

2 Replies

PE PeteB March 13, 2003 11:38 AM

UPDATE: I think I have resolved this...it seems to be a TreeView bug. You have to clear all nodes from the treeview before closing the form or they do not get cleared even once the form is gone...I assume this should be handled by the control therefore a bug. Code is: treeView1.Nodes.Clear() I do call GC.Collect() after as an added precaution.


PE PeteB April 8, 2003 08:06 AM

FYI: This does appear to have been the issue. Clear all nodes before exiting Form with Treeview.

Loader.
Live Chat Icon For mobile
Up arrow icon