Force Firefox 14 to free memory when opening/closing lots of popups

3

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?

Thanks.

aknghiem

Posted 2012-08-27T07:53:02.803

Reputation:

that's how firefox works unfortunately – MaVRoSCy – 2012-08-27T07:56:48.553

Answers

0

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?

Robin Whittleton

Posted 2012-08-27T07:53:02.803

Reputation: 411

0

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.

Wk_of_Angmar

Posted 2012-08-27T07:53:02.803

Reputation: 826