首页 > Windows开发 > 详细

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

时间:2020-03-06 10:11:10      阅读:245      评论:0      收藏:0      [点我收藏+]

解决方法如下:

-- 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内存占用太大的解决办法

原文:https://www.cnblogs.com/Im-Victor/p/12424653.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!