Linux Warlord Blog

venerdì, aprile 14, 2006

Diminuire il consumo di Ram di Firefox più diversi Hack

Firefox è un gran bel browser. Ricco di funzionalità. Estensioni che spuntano da ogni dove. Temi fino all'esaurimento. Il problema maggiore ? Il consumo di ram. Meno male che about:config è nostro amico.

There has been a lot of news flying around and I have simply not had the time to write about it, the last couple of days have been very busy, expect a flurry of articles in the coming days. Now lets explore the wonder that is known as Firefox.

Over the last few months I have noticed people complaining about Firefox and the memory ‘leaks’ and how much memory Firefox hordes for itself. I guess for some people the 40-60Mb of ram that Firefox is sitting on is expensive, but for me, Firefox doesn’t get close to touching my gig of ram, but for those performance nuts that like to do SuperPI runs while browsing the internet, this guide is for you. I have spent days and days (edit: hours) scouring the internet for all the tweaks, hacks, hax, plug-ins, extensions, and tricks that let you eke out every bit of performance and efficiency from Firefox. First off, the hacks.

Minimize Hack

The first hack that I have here is the popular Firefox Minimize Hack that has recently flashed through the internet. The purpose of this hack tries to keep Firefox from eating up your physical RAM and instead puts the burden on your hard drive, or at least that is the general reason behind it. To implement this hack, perform the following steps.

1. With Firefox up and running, type about:config and hit enter.
2. Right click on the new page and select New -> Boolean.
3. In the pop-up window, type in “config.trim_on_minimize” without quotes and hit enter.
4. In the next pop-up window, select True and hit enter.
5. Restart your browser

With that done, open up a bunch of tabs and monitor the memory usage. In my first run without this hack, Firefox was using 137.8 Mb of Ram. With all 30 tabs open again, Firefox was using 118.4 Mb, but when minimized this dropped to an astounding 4 Mb. However, this was too good to be true, I left Firefox minimized and came back 12 minutes later and the memory use had slowly creeped up to 42.4 Mb. While this was 10 times larger than the initial 4.2 Mb, I was still saving about 75 Mb. One note about this, the memory was still very slowly creeping up by about 1 Mb per minute, maybe more or less per minute, but either way it was still creeping. I would have liked to test to see if it would creep up to the original 118.4 Mb but that would have required more than an hour and I am impatient. Another note, when I had Firefox maximized it was using 66 Mb with as the main tab, but 119 Mb when I quickly browsed through all my tabs and then quickly retreated back down to 66 Mb. I don’t know what causes this, but either way, for the most time it was using 66 Mb. The verdict: useful and free with no downloads.

Back Button Hack

The next hack deals with Firefox’s Cache. Whenever you jump around the Internet, Firefox caches your previous pages to make your internet browsing blazing fast. However this causes Firefox to consume memory that you may not ever need to use. To implement this hack, perform the following the following steps.

1. With Firefox up and running, type about:config and hit enter.
2. Find “browser.sessionhistory.max_total_viewers” and instead of the -1 setting, change it to 0 and hit Enter.
3. Restart your browser.

Before using this hack I went to and entered 10 different articles but never touched the back button, just using links. Upon the 10th article, Firefox was using 41Mb. I performed the hack and performed the same step by visiting the same sites with a cleared Cache, and memory usage was down to 33.7 Mb. This value never changed even after a few minutes left idle on the final page. Verdict: not a large saving with a slight decrease in browser rendering speed, worth it if you are ram limited.

Network Hack

This next group of hacks all relate to the network.http group in about:config. Basically these various options open up your network connection to Firefox, permitting it to access information online as quickly as your connection will permit you. Since the majority of my readers utilize broadband connections, this will benefit you, 56k you are tough out of luck, sorry. To implement these hacks, perform the following steps.
1. With Firefox up and running, type about:config and hit enter.
2a. Find the entry called “network.http.pipelining” and set it to “true”.
2b. Find the entry called “network.http.proxy.pipelining” and set it to “true”.
2c. Find the entry called “network.http.pipelining.maxrequests” and set it to 16-32, but beware, if set too high you may risk banning yourself from various servers by being mistaken for a DoS attack.
3. Restart your browser.

Even though I am sitting on Georgia Tech’s campus with a blazing fast 100Mbit connection, it seems like with these options enabled, webpages load faster, pictures in particular. When I went to and started clicking around, all the pictures loaded at one time unlike how it used to load a picture at a time. Either Flickr enabled a quick optimization between me closing and opening Firefox, or this trick works. Either way, it hasn’t hurt my connection at all. Verdict: Causes pictures to load very fast, but I do see an increase in network activity, more spikes than constant travel with each pageload.

Cache Hack

This next hack deals with the memory Firefox uses as cache. In the default setting, Firefox will adjust the cache size to fit however many pages you have open. While this is useful, if you tend to only have a few pages open at a time, you can manually reduce the setting to a specified amount at the cost of reducing performance when Firefox runs out of cache. To implement this hack, follow these steps.

1. With Firefox up and running, type about:config and hit enter.
2. Right click on the new page and select New -> Integer.
3. In the pop-up window, type in “browser.cache.memory.capacity”. In the following pop-up window, specify how many Kb of ram you want to dedicate to the cache, I selected 32768(32Mb). I suggest a number between 16Mb and 64Mb, anything lower and performance will suffer, anything higher is excessive. Here you should experiment, or don’t bother if it worries you.
4. Restart your browser

I don’t know how much this helps or hurts performance, so far with 32Mb enabled I have yet to see a major difference, memory use dropped from 42Mb to 39Mb with the same pages open, but I don’t think this hack is what did that. Verdict: not sure if it is useful at all.

Download Manager Hacks

This next group of hacks deal with the download manager in Firefox. For those of you that don’t use the Firefox download manager, skip this section. I don’t know about you, but I personally hate the download manager, it is annoying and generally a distraction when it pops up with its messages and warning, so, let’s do away with it. Follow these steps to tweak/destroy your manager.

1. With Firefox up and running, type about:config and hit enter.
2. Take your pick of the following attributes to modify.
3a. at default shows the alert message for 2000 milliseconds or 2 seconds. I personally set it to 500 milliseconds; all I need is a quick blurb telling me my download is done.
3b. at default opens up the download manager immediately, which can be a big pain if you are downloading 10Kb files to your desktop, you don’t need that annoying manager to pop up. I have this guy set on 30,000 milliseconds or 30 seconds. If a file is larger than 30 seconds of download time, I might want to watch its progress.
3c. at default is set to false so that your manager doesn’t close itself. I set it to true just to get this thing out of the way the moment it is done, I like to watch progress, but I don’t need to waste space or the time to close it.
3d. at default flashes the download manager icon in your taskbar for 2 seconds, I prefer zero seconds to reduce annoyance, adjust to your preference.
4. Restart your browser.

These hacks are just my personal preference, you may like it just the way it is, or you may want to do more. Browse through the about:config and you’ll find tons of stuff to tweak. Verdict: personal preference, doesn’t increase performance, maybe productivity.

This last hack is less of a hack and more of a good habit you should pick up. I tend to clear my cache and download list at least once a week, sometimes more often. This will usually increase performance and it will also update all content, but on a slow connection this could hurt your performance, especially if you have pictures loaded in your cache that don’t change. Do this at your own digression.


Extensions are what make Firefox great, you can customize to your hearts content by adding extensions. The following list are the extensions that I use.


This extension places a page status bar over the address bar which creates a cool effect and also lets you know how much of the page is left to download. Useful for slower connections and just plain cool.

This is definitely the coolest extension I have seen. You know that cool thing that OSX does that lets you view all your currently open programs in little thumbnails? Well this does the same thing, but for your tabs! When I am writing an article, coding CS, or doing something else that requires lots of back and forth movement, this saves me a lot of time from having to ctrl-tab or click on tabs. To get to know reveal, take the quick 30 second tutorial that prompts you upon restart. I highly recommend this extension.

TabX is another great productivity increaser. I know whenever I have more than 2 tabs open and I am trying to select the last guy or close a tab, I mistakenly close the tab instead of click on the correct tab, causing me to close an incorrect tab. With TabX each tab gets an individual X which works when you have fewer than 10 or so tabs. Once you get to about 15 tabs, the X’s take up too much space, so use this at your own digression, I find it useful.

Who likes free online storage? I do and I’m sure you do too. This extension turns those 2+GB that Google has given to each of their users into 2GB of online storage. I find this as a great way to transfer files between computers with no need for a jump drives. While I don’t know how secure this extension is, I find it nice when I don’t want to carry a jump drive around, but nothing beats having a FTP server.

IE Tab

This causes Firefox to render a page with an embedded Internet Explorer within your Firefox window. I use this specific extension whenever a page renders terribly in Firefox. I wish they made an extension for Safari that would let you guys render my page in Firefox, sorry! Very useful when a page loads terribly. Be warned though, IEtab has a known memory leak but they are working on fixing it.

This extension was called in by Stu and it offers even more features than TabX and Fission. It puts “x” buttons on every tab, shows a loading status bar on each tab, lets you manipulate you add various properties to your tags, and the title goes red if the page has loaded and you haven’t checked up on it since it loaded. There are a bunch of featurs in Tab Mix Plus and if TabX isn’t enough for you, grab Tab Mix Plus.

Some people on mentioned this extension, which I have used before. Fasterfox lets you tweak everything I mentioned in the networking about:config and a few other options. I originally didn’t include Fasterfox because it tweaks a few things that could possibly slow down Firefox, such as the initial paint delay. On a side note, some admins on various servers started banning the Fasterfox prefetch routine and some have gone to the extent of IP banning, so be careful with what you install.

That about wraps everything up here, while I didn’t even touch the tip of the iceberg that is “about:config” I hope I will have managed to prod you in the right direction. I am very satisfied with the results from doing all of these hacks and using these extensions, they make using Firefox so much more enjoyable. I cannot promise that you will witness the same results, but for me they worked and I am happy. If you have anything to add, feel free to drop a comment and I will correct or add what you have to say.