Memory Leak in TreeView when CheckBoxes = True

J

Jessica

I have noticed a memory leak in the .NET TreeView control when the
CheckBoxes property is set to true. It only happens when a treeview
is on a form that is loaded and then unloaded. I created a small
program to test this where I had a button that loaded a form with a
treeview on it. When CheckBoxes is set to false and I load and unload
the form about 20 times, the memory use stabilizes. When CheckBoxes
is set to true and I load and unload the form many times, the memory
use just keeps going up.
Is this a known issue? Has anyone else seen this? Any ideas for a
workaround? I haven't found one yet.
Thanks,
Jessica
 
C

Calvin Luttrell/ProjectThunder.com

Jessica,

Are you cleaning up the objects as you are working on them? Can you post a small example? In any event how much memory are we talking about here? It may take a few moments for GC to kick in and clean that stuff up.

-Calvin Luttrell
www.projectthunder.com
Enter to win a XBOX or a Portable DVD Player
Monitored forums www.projectthunder.com/forums
 
J

Jessica

All I did was create a C# project with 2 forms in it. On the first
form I placed a button and added code so that clicking this button
would launch the second form. On the second form I dropped a TreeView
control and added a few items. That's it. If I run this and
load/unload the second form many times I see a leak. It's about 4K
per load/unload. I don't think there are any objects that I need to
clean up since this is managed code. I ran it anywhere from 50 to 100
times and the GC never kicked in when CheckBoxes was set to true.
However, when it was set to false, the GC kicked in after maybe 15
runs and the memory obviously stabilized. This never happened when it
was set to true. I hope this helps.
Thanks,
Jessica
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top