I am developing C# application that every 10 seconds refreshes TreeView
control. I am using 3 custom classes for renewing the TreeView control.
And It seems that I do not free some resources, so every 10 seconds the
memory used by my application is increasing ( I was monitoring that
from task manager ) I know that because of the way Garbage Collector
works, it is not recommended to trust the task manager so I downloaded
AQtime ( http://www.automatedqa.com/ ) and monitoring my application
with this software it turned out that every 10 seconds a new instance
of my custom classes are created, and they are not released. I've
tested the application for 5 minutes and I had 30 instances, and the
used memory was still growing up. This software have a function to
force the garbage collection, and I have tried it - the count dropped
to 7. I've forced the garbage collector again - the count was 1.
As far as I am informed how the GC is working isn't it supposed to
start every time it need new memory?
Actually I find this very strange. Can someone help?
Somewhere in Internet I read that it is not recommended to call the
Garbage Collector ( GC.Clollect() ). Can you tell me whether this is
true and if yes why.
Thanks.