Re: Memory Leak in TreeView when CheckBoxes True

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jessica (jessielu_at_yahoo.com)
Date: 06/14/04


Date: 14 Jun 2004 07:43:52 -0700

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

"Calvin Luttrell/ProjectThunder.com" <calvinl@projectthunder.com> wrote in message news:<e3SRODZUEHA.3420@TK2MSFTNGP12.phx.gbl>...
> 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
>
> > 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
> --


Quantcast