Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory usage- tips to optimization needed

Status
Not open for further replies.

tutuster

Programmer
Feb 2, 2005
41
0
0
FI
I'd like to know if someone has any tips or articles about optimizing .net apps. I have an app that takes about 30 megs of ram at startup and loading the mainform, which seems quite "normal" to vb.net apps.

I call GC.Collect() everytime a mdi-form is loaded, and closed too. This has no or just a bit effect to the RAM usage.

I have Crystal Reports in this app too. Loading the CR viewer makes the ram usage go sky high, about 50-60 megs. Closing the form has no effect, the app uses that 50-60 megs even when there are no mdi-forms opened.

The interesting this is, that if I minimize the app to taskbar and bring it up again, mem usage goes as low as 3 megs. It piles up a little but not significantly. What does Windows (xp) do to free that memory? Can I do the same thing via vb-code?

Any hints greatly appreciated,
Tutuster
 
Using GC.Collect() all over the place is usually counter-productive. Instead, you should pay attention to calling .Dispose() on any object that implements IDisposable, and let the garbage collector do it's work.

If any of your classes encapsulate unmanaged resources, or other classes which themselves implement IDisposable, you should implement it too.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top