Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1086957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:52:41+00:00 2026-05-16T22:52:41+00:00

public partial class Form1 : Form { bool AfterDocumentCompleted = false; int steps =

  • 0
public partial class Form1 : Form
{
    bool AfterDocumentCompleted = false;
    int steps = 0;

    public Form1()
    {
        InitializeComponent();
        webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocCompletedHandlerCopy);
        webBrowser1.ScriptErrorsSuppressed = true;
    }

    private void DocCompletedHandlerCopy(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        if (webBrowser1.ReadyState == WebBrowserReadyState.Complete && e.Url == webBrowser1.Url)
        {
            AfterDocumentCompleted = true;
        }
    }

    private void NavigateAndWait(string urlString)
    {
        AfterDocumentCompleted = false;
        webBrowser1.Navigate(urlString);
        while (AfterDocumentCompleted == false) Application.DoEvents();

        steps += 1;
        label1.Text = string.Format("{0:00000} / {1}MB", steps, Environment.WorkingSet / (1024 * 1024));
    }

    private void button1_Click(object sender, EventArgs e)
    {
        while (true)
        {
            NavigateAndWait("http://www.crucial.com/");
            NavigateAndWait("http://www.google.com/");
            NavigateAndWait("http://www.microsoft.com/");
            NavigateAndWait("http://www.stackoverflow.com/");
            NavigateAndWait("http://www.yahoo.com/");
        }
    }
}

When I click Button1 (so it calls button1_Click) and wait for about 1 hr, the ram consumed according to Task Manager and label1 is about 1000MB (is about 20MB as soon as I click it and the rate of grow is somewhat linear). Is the WebBrowser some kind of alpha version of a browser that is not supposed to be used at all by anyone, or am I doing something wrong. If you wonder why in the world do I want to navigate for ever to those pages, this is just the isolation of a problem I was having (see my other question here).

Edit: About a week ago I installed and uninstalled IE9 beta. I think that might have originated the problem. Just tested it on a Windows Vista IE8 and it didn’t grow any bigger than 80-90MB. I’ll just reinstall Windows and I hope I don’t need to downgrade to Windows Vista.

Edit2: I finally found the cause of the problem. It was not IE9 beta. It was the fact that I set IE not to show any pictures. I thought not showing pictures would make navigation faster and lighter, but apparently it activated some bug and the memory consumed started growing like crazy. Still, with pictures the memory grows but a lot slower.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:52:42+00:00Added an answer on May 16, 2026 at 10:52 pm

    and wait for about 10 minutes, the ram consumed according to Task Manager is about 200MB

    • 200 MB is not a lot
    • TaskManager is not suitable for measuring memory use

    The WebBrowser you use through the control is IE. It will consume quite a bit of memory, mostly to cache content. But you don’t really have a problem with memory.

    Additional:

    I ran your App and changed only this method (add Label1) :

        int counter = 0;
    
        private void NavigateAndWait(string urlString)
        {
            AfterDocumentCompleted = false;
            webBrowser1.Navigate(urlString);
            while (AfterDocumentCompleted == false) Application.DoEvents();
    
            counter += 1;
            label1.Text = string.Format("{0:000} {1}", counter, 
               Environment.WorkingSet/ (1024*1024));
        }
    

    When I let it run for a while Memory stabilizes at a 75-85 MB range.

    In a comment you mention 1.6 GB, that is a problem. But that was not with this code. So you have a start: look for the differences.

    Edit 2

    Upgrade your version of IE. I am running this with Vista/32 and IE8 and the WorkingSet won’t go over 90MB. (600 pages)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.