#region 强制清除缓存
        [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
        public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize); ////// 释放内存 

        public static void ClearMemory()
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
            }
        } 
        #endregion

  

相关文章:

  • 2021-11-30
  • 2021-12-24
  • 2022-02-19
  • 2021-12-18
  • 2021-12-02
  • 2021-11-17
  • 2022-02-19
猜你喜欢
  • 2021-08-14
  • 2021-11-23
  • 2022-02-11
  • 2022-01-02
  • 2021-11-27
  • 2021-08-06
相关资源
相似解决方案