Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently trying to run some tests on a web application using Selenium IDE with Firefox 14. The tests mainly consist in loading a page containing thousands of links and clicking on every of those links. Of course, each time a popup shows, I tell Selenium to close it and proceed with the remaining links.

However, it seems that even if I close the popups, Firefox is not freeing memory. Usually, I end up with Firefox crashing after opening 1500 popups (around 2.5Gb of memory usage).

Is there any way to force the browser to free memory? Maybe something I should set in about:config? Or is there a flaw with Selenium?


share|improve this question

migrated from Aug 28 '12 at 13:04

This question came from our site for professional and enthusiast programmers.

that's how firefox works unfortunately – MaVRoSCy Aug 27 '12 at 7:56

Although that’s a fairly extreme use case the fact that Firefox is crashing is not great.

Are you running with a clean profile i.e. all extensions disabled? Extensions can reserve and hang onto memory on every page load; it’s a common source of leaks. I believe Firefox 15 (which is being released today) has a blanket fix for extensions doing this so it might be worth upgrading and seeing if the problem is still occurring. Here’s Extremetech’s chart on this issue:

Extremetech’s chart showing memory consumption being massively better in Firefox 15.

Alternatively, about:memory has a Minimize memory usage button that tries to free up reserved but currently unused memory. Might it be possible to script Selenium to navigate there and press the button?

share|improve this answer

This is problem is due to Firefox's garbage collection and there is not much you can do about it. Disabling JavaScript on the tabs that you open (if possible) might help since there will be less JS memory leaks. These leaks can be particularly problematic with buggy add-ons, so I would recommend that you do the tests in either Safe Mode (disable all extensions) or use Google Chrome - which does not suffer from memory leaks to the same extent as Firefox does since it separates each tab into a separate process, though does not seem to perform as fluidly as Firefox when working with a large number of open tabs.

share|improve this answer

You must log in to answer this question.