C#程序节省内存

 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 }
我走啊走 走啊走......
原文地址:https://www.cnblogs.com/qxw0816/p/1486180.html