C#强制回收垃圾

[DllImport("psapi.dll")]
private static extern int EmptyWorkingSet(int hProcess);
public void HandleSetGC()
{
GC.Collect();
GC.WaitForPendingFinalizers();
EmptyWorkingSet(Process.GetCurrentProcess().Handle.ToInt32());
}

posted @ 2019-12-19 10:02  搬砖的L先生  阅读(709)  评论(0编辑  收藏  举报