c# 内存整理,EmptyWorkingSet

[DllImport( " psapi.dll " )]
        
static   extern   int  EmptyWorkingSet(IntPtr hwProc);

        
public   void  ClearMemory()
       
{
            Process[] process;
//这个数组存放当前的所有进程信息
            process = Process.GetProcesses();//取得进程信息
            try
           
{
                
for (int i = 0; i < process.Length; i++)
                    EmptyWorkingSet(process[i].Handle);
//依次释放每个进程的内存
            }

            
catch
           
{

            }

        }

你可能感兴趣的:(set)