1 using System.Runtime.InteropServices;
2 using System.Diagnostics;
3
4 [DllImport("kernel32.dll")]
5 private static extern bool SetProcessWorkingSetSize(IntPtr process,int minSize,
6 int maxSize);
7
8 private static void FlushMemory()
9 {
10 GC.Collect();
11 GC.WaitForPendingFinalizers();
12 if(Environment.OSVersion.Platform == PlatformID.Win32NT)
13 SetProcessWorkingSetSize( Process.GetCurrentProcess().Handle , -1, -1);
14 }
2 using System.Diagnostics;
3
4 [DllImport("kernel32.dll")]
5 private static extern bool SetProcessWorkingSetSize(IntPtr process,int minSize,
6 int maxSize);
7
8 private static void FlushMemory()
9 {
10 GC.Collect();
11 GC.WaitForPendingFinalizers();
12 if(Environment.OSVersion.Platform == PlatformID.Win32NT)
13 SetProcessWorkingSetSize( Process.GetCurrentProcess().Handle , -1, -1);
14 }