I have a button click event on my main application window that opens a form. The form has a lot of controls, loads a lot of data, and uses a lot of memory. When I close the form the memory is no deallocated. Every time I open the form, 7 megabytes of RAM and 7 megabytes of virtual memory are eaten up.
Here are the only lines of code in the button click event:
Dim frminv As New FrmInvoice()
frminv.MdiParen t = Me
frminv.Show()
As soon as the form is closed, all objects should be eligible for garbage collection, but they are never garbage collected. (I have run a loop to open the form and close it hundreds of times--the garbage collector never runs).
What can I be doing wrong? What could possibly be referencing the FrmInvoice that prevents it from being deallocated?
Here are the only lines of code in the button click event:
Dim frminv As New FrmInvoice()
frminv.MdiParen t = Me
frminv.Show()
As soon as the form is closed, all objects should be eligible for garbage collection, but they are never garbage collected. (I have run a loop to open the form and close it hundreds of times--the garbage collector never runs).
What can I be doing wrong? What could possibly be referencing the FrmInvoice that prevents it from being deallocated?
Comment