Freeing Virtual Memory on app close

J

jtertin

I was wondering how to manage Virtual Memory usage within a VB app. I
have a form with a trend on it that takes ~40MB of virtual memory when
it is loaded (depending on the amount of data being plotted). When
the form is closed, the memory is still being used (even though I call
the .dispose method of the chart object). Every time I re-open the
same form, there goes 40MB more virtual memory. This memory is not
released until the application terminates.

So, my question: how do I explicitly release the memory being used by
this form?

Thanks!
 
K

Kevin Spencer

Something is not being disposed. One way to figure out what is to step
through the code one line at a time and see exactly what is causing the
memory allocation, and what is not being disposed.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
J

jtertin

There are only two objects that I should have to worry about disposing
- the chart object on the form, and the form itself. The form itself
should (correct me if I am wrong) be disposed when it is closed. I
have the [ChartObject].Dispose() method being called on the form's
closing event. Is this correct? Something is still awry as it still
does not free up VM usage when the form is closed. Any suggestions?
 
K

Kevin Spencer

First, you will have to dispose the Form. More than that I can't say, as I'm
not sure how you're invoking the Form, but you will certainly have to
dispose it unless you plan to re-use it.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

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