troubleshooting Question

.NET form re-open memory leak

Avatar of alexandria122
alexandria122 asked on
Visual Basic Classic.NET Programming
5 Comments1 Solution921 ViewsLast Modified:
I have a VB.NET program (3.0) that opens a very heavily populated form with the click of a button.  The form has 7 tab pages with hundreds of controls.  The first time I open the form, my memory usage jumps 180 MB - which is fine, except when I close the form, my memory usage never goes down.  Every time I re-open the form by clicking the button, my memory usage jumps another 70 MB.  We've had complaints from users using this program that they are getting Out Of Memory errors after clicking the button about 10 times.

To test .NET handling of large forms, I created a dummy Windows programs with 1 form with a single button on it that opens another form with 7 tab pages and hundreds of controls (there is no code-behind, therefore no extra baggage involved - just .NET objects).  The first time I clicked the button, the process memory jumped 22 MB (60 MB total).  I closed the form, set the object to Nothing in code and forced GC.Collect().  Still 60 MB.  Clicked the button repeatedly and repeatedly closed the form.  After about 7 clicks, I was at 92 MB and no sign of it going down.

Is this something that anybody ever ran into?  How can I force .NET to let go of a form out of memory once it's been closed?  I don't care about re-load time.  
And if .NET does keep form controls in memory for speed, why does memory usage continue going up in increments as I click the "New form" button with no end in sight?
ASKER CERTIFIED SOLUTION
alexandria122

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros