Chas' Compilation

A compilation of information and links regarding assorted subjects: politics, religion, science, computers, health, movies, music... essentially whatever I'm reading about, working on or experiencing in life.

Saturday, December 06, 2008

Firefox 3 Memory Issues Explained

Pat and I were talking about how the latest versions of Firefox (3.X) uses memory. He read that at times it uses much greater amounts of memory than Firefox 2 did. Then I came across this article, explaining how the usage is now more efficient, and verifiable in test results:

Firefox 3 Memory Usage
[...] Ways to test

There are many ways to measure memory usage in a browser. Open up 10 tabs with your favorite websites in them and see how much memory the browser is using. Close all but the last tab and load about:blank or Google. Measure again. Another simple test is simply loading Zimbra, Google Reader and Zoho each in their own tab and logging in. We’ve learned that users do so many things with the browser it is nearly impossible to construct a single test to measure memory usage.

We wanted more of a stress test — One that was more reproducible than loading random sites from the web.

[...]

For the results below we loaded 29 different web pages through 30 windows over 11 cycles (319 total page loads), always opening a new window for each page load (closing the oldest window alive once we hit 30 windows). At the end we close all the windows but one and let the browser sit for a few minutes so see if they will reclaim memory, clear short-term caches, etc. There is a 3 second delay between page loads to try and get all the browsers to take the same amount of time. We used the proxy server that is part of Standalone Talos to make sure we were serving up the same content. We had to disable popup blocking to allow the test window to open the 30 windows for running the test. You can get the simple webpage test here and the python script to monitor memory usage here. These things are built on top of the standalone talos framework so you’ll need to drop the python script in with talos to get good results. Mad props to Mike Schroepfer for getting this all working.

Results



Looking at the graph:

* All browsers increase in memory use slightly over time, but the Firefox 3 slope is closer to 0.

* The _peak_ of Firefox 3 is lower than the terminal size of Firefox 2!

* The terminal state of Firefox 3 is nearly 140MB smaller than Firefox 2. 60% less memory!

* IE7 doesn’t appear to give any memory back, even after all the windows are closed!

* Firefox 3 ends up about 400mb smaller than IE7 at the end of the test!

This is just one test that I feel shows the great progress that has been made. We’ll continue working on adding additional tests that can measure more of the ways that users use their browser.

Conclusion

Our work has paid off.

We’re significantly smaller than previous versions of Firefox and other browsers.

You can keep the browser open for much longer using much less memory.

Extensions are much less likely to cause leaks.

We’ve got automated tools in place to detect leaks that might result from new code. We’re always monitoring and testing to make sure we’re moving in the right direction.

All of this has been done while dramatically improving performance. [...]

If you follow the link to the full article, there is LOTS more information, and embedded links too. I just excerpted the parts that seemed to matter most - or should I say, that I actually understood best ;-).
     

Labels: , , , ,

1 Comments:

At Sun May 24, 04:30:00 PM 2009, Anonymous Anonymous said...

You are making a big mistake on how to measure the used memory of your processes. You read the MemUsage column but your are missing the virtual memory of each process, so it’s only half the truth, in fact even less.

On each OS, if a process memory (measured as MemUsage) reaches a defined size, a part of the memory is mapped into the virtual address space (VirtualMem). So the actual memory used will NOT increase, 'only' the virtual memory space increases constantly. Note that also the virtual memory is allocated by the process and it cannot be used by other processes, nor by the system! Virtual memory still is part of the appropriate process.

So if you want know the real amount of used memory, then you have to ADD the values of MemUsage and VirtualMem for each process. To see the virtual memory you also need to display that column in your taskmanager as it is not shown per default. You will see a big surprise.

 

Post a Comment

Links to this post:

Create a Link

<< Home