Webbrowser Control Memory Management Question
I have a C# application that uses the webbrowser control. I've noticed that as I load more web pages through the webbrowser control my program continues to consume more and more memory. (It starts at 9MB and quickly climbs to 40MB by simply loading web pages.)
My question is really two part:
Q1: What is the reason for this compounding memory comsumption? Web cache, memory leak, ... ?
Q2: Is there some sort of garbage collection I should be manually performing such as routinely clearing some sort of web cache in RAM?
regarding Q1:
I believe the following may be the problem.
WebControl leaks memory due to the way JavaScript works. here's an article explaining why:
http://jgwebber.blogspot.com/2005/01/dhtml-leaks-like-sieve.html
as far as Q2 concerned, I wonder if IE does something like this when hosting the WebControl. I would love to hear about it if so.
Alexey.
JBrown9264 wrote: |
Q2: Is there some sort of garbage collection I should be manually performing such as routinely clearing some sort of web cache in RAM? |
|
.NET is supposed to have an 'automatic' garbage collection, so the programmer does not have to manally release memory resources. If that is still a concern to you, try to release variables in your code wherever possible.
One question I have is how secure is the webbrowser control? What dictates the security rules for that control?
Yes, I know about the standard garbage collection but was wondering about additional measures specific to the webbrowser control. It seems that most people have not played around with this control so it is hard to get answers.
As for the security level, that is a good question. I do not know how it decides the security level. I would assume it inherits I.E.'s security level on the client machine. Print properties works that way in the webbrowser control.
But I am still left with the problem of memory consumption. Note: I am not using javascript, these are html only files.