I noticed in the last week or two that Firefox was often consuming a lot of my laptop’s RAM. Even though I have half a gig of RAM on this machine, Firefox was often grabbing most of the available RAM, causing other applications to occasionally stall, or at least cause the system to slow down a bit. (Will tells me this isn’t actually a slow-down, just the system degrading as it has t swap files to disk; were I on a desktop with a speedy hard drive, I probably wouldn’t notice. But I’m on a laptop with a slower hard drive, so I do.)
After a bit of Googling, I found this thread on MozillaZine, an online support site for Firefox. In another about:config hack, this one helps you force Firefox to behave a bit better when it comes to system memory. I followed the directions to limit Firefox’s available RAM to 16 megs, and this seems to have significantly improved performance. (By significantly, I’m guessing that page loads have decreased by another 30-50%.)
In other words, the improvement is noticeable. Will update if I see any negative impact, but so far this seems to be a great tweak.
6 responses to “Yet another Firefox tweak – fixing memory leaks”
As someone who uses an (admittedly antiquated) desktop at home, I can say I do notice firefox filling up my memory pretty frequently. I always chalked it up to the fact that web browsers just tend to do it. I will try the hack myself.
This tweak doesn't set the total amount of memory that the browser will use, but the amount that it will use for caching. This looks like it will be a helpful optimization until the program is able to dynamically resize the memory cache.Generally you'll want to avoid swapping to disk, either in Firefox or in other programs. What happens when the Firefox memory cache gets really big is that other programs are forced to swap memory to disk. Then, when you switch to those programs, Firefox has to swap to disk while the other program is swapped in. And so on, until you spend a lot of processor time waiting on disk i/o operations. The technical term for this is thrashing.You optimize to reduce bottlenecks, therefore you have a local disk cache because the network is slow, and a memory cache because the disk is slow. If your cache is too large, you swap to disk, which is slow.The trick is to get commonly used programs to stay in memory as much as possible, either by reducing their memory requirements, or by buying more RAM.
For us morons…how do you set FF memory to 16m?
In about:config, you'll want to add browser.cache.memory.capacity, an integer, with a value in kilobytes, such as 16000 (or approximately 16MB). To do this, right click, and select new, then integer. Name the new preference, click OK, then enter the value, click OK, and restart Firefox.
Thanks! I have implemented the hack, and it works great. I also found some other hacks for Firefox here. I think I might have been sent there from here, but my memory is so bad………In fact, Dorie is a cousin of mine. She's got the better memory.
Firefox is getting to be annoying in this regard. I just noticed that it has been eating 90% and more of my CPU. I'll have to track down those additional hacks too. I'd hate to go back to IE, but this is getting to be too much.