Memory Leaks

  • Thread starter Thread starter Bhargavan
  • Start date Start date
B

Bhargavan

Hi group,
I have created a User control and whenever I use that usercontrol in a form,
there is a memory leak. When I open and close the form, the form along with
my user control is not disposed. It does execute the dispose methods in my
form and in my usercontrol. I am sure there is something wrong with my
Usercontrol but I am not sure where exactly the problem is. Any suggestions
will be greatly appreciated.
Thanks,
Bhargavan
 
Are you sure that the form and the user control have been freed but the
garbage collector simply hasn't gotten around to cleaning them up?
Just because you call Dispose doesn't mean that the memory will be
released immediately.
 
Hey Bruce,
I was testing for Memory leaks in my application using a tool called .NET
memory profiler. I open and close a form in my application and then got a
snapshot of the memory usuage of my application. The snapshot showed that my
form and all the controls (including the user control that I created) in my
form were still un disposed. But if I test the same form without my
usercontrol in it, then it works fine (controls and form are disposed). Any
ideas on what might be causing this?
Thanks,
Bhargavan
 
Do you have static members in your user control ?
Does your usercontrol reference the form or an element contained in your
form ?
 
Back
Top