c#垃圾清除,特别有效

1 [DllImport("kernel32.dll"),EntryPoint = "SetProcessWorkingSetSize"]
2 public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize,intMaxSize); 
3 
4 GC.Collect();
5 GC.WaitForPendingFinalizers();
6 if(Environment.OSVersion.Platform == PlatformID,Win32NT)
7 {
8     SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle,-1,-1);
9 }