Re:Free memory used by Internet Explorer
After you close this form, minimize your application's main form.. does the
memory go away? If so, you're probably seeing the memory "used" because the
application is keeping it in its working set. See this thread on the
dotnet-CLR archives:
[
http://discuss.develop.com/archives/wa.exe?A2" rel="nofollow" target="_blank">discuss.develop.com/archives/wa.exe=ind0209C&L=DOTNET-CLR&D=0&I=-
3&P=1450]
Basically, you want to call the Win32 api function
SetProcessWorkingSetSize(hProcess, -1, -1).
If you're not familiar with P/Invoke, here's some code....
[DllImport("kernel32.dll")]
public static extern bool SetProcessWorkingSetSize( IntPtr proc, int min,
int max );
...
...
public static void ReclaimMemory()
{
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
SetProcessWorkingSetSize( Process.GetCurrentProcess().Handle, -1, -1 );
}
"Andre Nogueira" <
anog@netcabo.pt.NOSPAM>wrote in message
Quote
Hi there
In my VB.Net 2003 program, I use an Internet Explorer control
(shdocvw.dll).
When I open the form containing the control, the program "eats" 20MB of
RAM.
So far so good - IE itself uses about 20MB of ram to run.
The problem is that when I close the form (close it, not hide it).. the
20MB
are still used by the program!
The question is, how do I free them?
I tryed using
WbControl.Dispose()
WbControl = Nothing
on the Closing event of the form, but with no results.
Any ideas?
Thank you in advance! =)
Andre Nogueira
-