Can anyone explain to me why this code generates so much memory usage when you go to next pages in webbrowser (e.g. click back and forward, after 3 minutes memory is over 300 MB)
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement input in webBrowser1.Document.GetElementsByTagName("input"))
{
if (input.GetAttribute("type").ToLower() == "text")
{
input.GotFocus += null;
input.LostFocus += null;
}
}
How to free memory in this case? Instead null I want to add this.
void GotFocusForm(object sender, EventArgs e)
{
Form2.Instance.Show();
}
void LostFocusForm(object sender, EventArgs e)
{
Form2.Instance.Hide();
}
For a week I am looking for a solution. Thank you very much for help.
After a few back and forward. Memory