关于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);

打赏

本文固定链接: https://www.cxy163.net/archives/1314 | 绝缘体

该日志由 绝缘体.. 于 2016年09月09日 发表在 首页 分类下,
原创文章转载请注明: 关于C#的WebBrowser内存占用太大的解决办法 | 绝缘体

报歉!评论已关闭.