How can I reduce the memory consumption?

  • Thread starter Thread starter liubin
  • Start date Start date
L

liubin

I have created a simple program using C#/.NET. It is very small program
without explicit system resources request in the code. However, the memory
consumption is even above 17M(shown in Windows Task Manager), much higher
than 5M of the same one developed with MFC before.

Now I wonder if there is any effective way to optimize .Net program
achieving following two objectives:

1. Reduce system resources consumption of the program created with .NET/C# ?
2. Speed up the program's startup?

Many thanks for your great help!
 
You can use those,

(1) add this after you finish the start up
GC.Collect()
GC.WaitForPendingFinalizers()
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1)

(2) use "Ngen"


Do not complain the C#.Net app start up time, wait unit you c the VC++.Net
app
BTW, why do not try VC++.net ?
 
Back
Top