I am using a custom text box (read only) that consist of 2 WebBrowser components. It's displaying text with complicated layout (Generating a html code was a simplest option to make such a text viewer).
I am also binding the mousedown event on all components:
foreach (HtmlElement html in webBrowser1.Document.All)
{
html.MouseDown += new HtmlElementEventHandler(Scrollback_Clicked);
}
this happens after each time where I finish loading of html source. (this is irrelevant but it's the only customization of WebBrowser control I made, just in case it was the reason why it doesn't work)
However, after several hundreds of reloads the text box eats about 2GB of ram, I suspect it's a cache the browsercontrol has implemented, which stores all HtmlDocuments that were generated so far.
Is there a way to disable or flush the cache of WebBrowser control?