• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Freeing memory when closing MDI window

I have this application in VB.net, it's got a mainwindow that allows the user to do a search and when the SEARCH button is pressed the result is displayed in an MDI-child window. While watching Windows Task Manager and doing another 20 searches my application takes up over 100'000Kb of memory. Ok, it does have 20 MDI windows open with a datagrid on, so that might be fair(?).

BUT, when closing all these MDI-childwindows, according to Task Manager it doesnt release any memory at all. So if I then start to go berserk on the SEARCH button again it takes up even more memory!

It is still a very simple app, what should I do?

Regards Anders
0
snoffy
Asked:
snoffy
1 Solution
 
ptakjaCommented:
Sounds like you need to force the garbage collector to run.  In the portion of code that releases your MDI resources add this line:

GC.Collect()

That will force the garbage collector to actually release the resources.

Jeff
0
 
snoffyAuthor Commented:
That did A LOT, but not all. Doing 30 searches and closing them leaks about 7 Mb of memory.

Any thing else I could do?

//Anders
0
 
RonaldBiemansCommented:
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now