Optimize Firefox’s memory usage by tweaking session preferences

I’m a heavy tabbed browsing user - I have around 30 tabs open in my day-to-day Firefox profile all the time. Since the day Firefox 3 was released, I’ve noticed Firefox progressively getting slower with this particular Firefox profile (I use a different profile for web development). When it got to the point where changing tabs took a noticeable pause of 1-2 seconds, I tweaked some of Firefox’s session store and history preferences and now things are blazing fast again.

Here’s what you can do:

  1. Go to about:config in Firefox.
  2. Type in “session” in the “Filter” box.
  3. Edit browser.sessionhistory.max_entries - this is the number of pages stored in the history of your browsing session. Basically these are pages that can be reached using your Back and Forward buttons. The default is 50 - I reduced it to 20.
  4. Edit browser.sessionhistory.max_total_viewers - this is the number of pages that are stored in RAM so that they aren’t re-processed by Firefox’s rendering engine. This is what allows you to go Back to a page in Firefox and have it load almost instantaneously. The number of pages stored actually depends on the amount of RAM on your machine (see this). I reduced this to 4 (I have 2GB RAM).
  5. Edit browser.sessionstore.max_tabs_undo - the number of tabs you can restore after closing them (you can do this with Ctrl/Cmd-Shift-T). The default of 10 is more than I really need, so I reduced it to 3 tabs.
  6. Edit browser.sessionstore.interval - Firefox saves your session after every 10 seconds by default. I changed this to a more conservative 30000 milliseconds.

You can read more about these preferences and more at the MozillaZine Knowledge Base. If you’ve any tips on how to improve Firefox’s performance, be sure to share!

12 Comments & TrackBacks (Add yours)

Paper doll icon
whitemoon's Gravatar

nice! i’ve changed my settings like yours already. =)

Posted by: whitemoon on September 10, 2008 10pm

Paper doll icon
Fred's Gravatar

Great tips!

Thank!

you might also enable these to get faster network speed:

network.http.pipelining => true
network.http.pipelining.ssl => true
network.http.proxy.pipelining => true

:)

Posted by: Fred on September 11, 2008 7pm

Paper doll icon
Chu Yeow's Gravatar

Hey Fred, thanks for sharing those. I’m already using them :)

Posted by: Chu Yeow on September 11, 2008 9pm

Paper doll icon
Todd Partridge's Gravatar

Good Tips!

I have a nearly ten year old computer and I was really disappointed when I upgraded from Firefox-3.0-beta5 to Firefox-3.01. The Mozilla Team must have boosted the memory allocation. About every minute I had large amounts of writing to the hard drive. I found out that this was Firefox saving the session to the hard drive. I adjusted the preference “browser.sessionstore.interval” to an absurbedly high (thank god Firefox is as stable as it is) 300000 and I got my browser back, thanks!

Posted by: Todd Partridge on September 12, 2008 5am

Paper doll icon
Chu Yeow's Gravatar

Glad I could help Todd. I’m gonna increase my browser.sessionstore.interval even more now that you’ve had good results with it. Firefox is still taking up a lot of virtual memory on my Mac.

Posted by: Chu Yeow on September 12, 2008 9am

Paper doll icon
tabrez's Gravatar

Thanks for the tips.

Posted by: tabrez on September 12, 2008 9pm

Paper doll icon Paper doll icon
Jackson Pires's Gravatar

Hi!

Please forgive my grammar and syntax because my english to write is not good yet.

I like only to iform you that I translate this post to portuguese, and I like to know if you allow this.

The post translated is

thanks!

Posted by: Jackson Pires on September 25, 2008 7pm

Paper doll icon
Chu Yeow's Gravatar

Hey Jackson, I’ve no problems with that at all, thanks for taking the time to translate it!

Posted by: Chu Yeow on September 28, 2008 11am

Paper doll icon
mbah gendeng's Gravatar

yes i try n thanks for share

Posted by: mbah gendeng on October 7, 2008 11am

Paper doll icon
Tweakare le preferenze della sessione di Firefox e risparmiare la memoria usata | Firefox Blog's Gravatar

[…] Di Chu Yeow su Redemption in a blog […]

Posted by: Tweakare le preferenze della sessione di Firefox e risparmiare la memoria usata | Firefox Blog on November 14, 2008 9pm

Paper doll icon
Lou K.'s Gravatar

My problem isn’t so much RAM usage but CPU - I usually keep between 60-80 tabs open and somewhere in there are a bunch of javascript and flash scripts running continuously. It’d be nice if one could “put them to sleep”, as described here -

http://matthew.gray.org/2006/08/someone-write-this-firefox-plugin.html

and I added a bit more here, adding another potential solution -

http://tumblr.klepner.com/post/59565611/firefox-enhanced-tab-session-management

Posted by: Lou K. on November 15, 2008 12am

You can subscribe to the RSS feed for comments on this post.

Post a comment

(required)

(required, but never displayed)


You can format your comments using XHTML. Your email address will not be displayed or used for nefarious purposes.

Only following tags are allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>