C # WebBrowser memory footprint on the big solution

Solutions are as follows:

- in  class (cited in the 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 the when you want (in the execution method) to reduce the memory
 
            Foreign IntPtr = GetCurrentProcess ();
            SetProcessWorkingSetSize (exterior, - 1 , - 1 );

 

Guess you like

Origin www.cnblogs.com/Im-Victor/p/12424653.html