关于C#的WebBrowser内存占用太大的解决办法

解决方法如下:

-- in class definition (在类中引用)
 
        [DllImport("KERNEL32.DLL", EntryPoint = "SetProcessWorkingSetSize", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
        internal static extern bool SetProcessWorkingSetSize(IntPtr pProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize);
 
        [DllImport("KERNEL32.DLL", EntryPoint = "GetCurrentProcess", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
        internal static extern IntPtr GetCurrentProcess();
 
-- code to call when you want to reduce the memory(在方法中执行)
 
            IntPtr pHandle = GetCurrentProcess();
            SetProcessWorkingSetSize(pHandle, -1, -1);

 

关于C#的WebBrowser内存占用太大的解决办法

上一篇:解决win10提示“你的Windows许可证即将过期”的方法


下一篇:WebAPI-HTTP编程模型