// Internet Duct Tape

How to fix the Firefox memory leak (Firefox hack)

Posted in Firefox and Greasemonkey, Popular Posts, Technology by engtech on December 02, 2006

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

These configuration changes are a trade-off between internet browsing speed and memory usage. They are most useful if you are multitasking and need Firefox to be less of a memory hog while using other applications.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

Related Posts

Further Reading

Ryan at CyberNet installs 200 Firefox extensions (via Rooster) and checks memory usage. It jumps from 145 MB to 195 MB after two hours (note that this is a worst case scenario).

Mozillazine article on reducing memory use in Firefox.

List of popular extensions that have memory problems.

Leak Monitor extension for detecting memory leaks.

102 Responses

Subscribe to comments with RSS.

  1. Matt Foxtrot said, on December 03, 2006 at 7:14 am

    This is really useful! Thanks!

  2. […] How to fix the Firefox memory leak (Firefox hack) « //engtech (tags: firefox memory leak fixes?) […]

  3. symbolik said, on December 10, 2006 at 4:11 pm

    Awesome blog, great article. I added it to my blogroll, hope you don’t mind. I really like what you were able to do with Sandbox – if I do not have to purchase the CSS upgrade to mod it, I may switch over myself.

  4. engtech said, on December 11, 2006 at 1:19 am

    Thanks symbolik.

    It’s comments like yours that keep this fun to do.

    The CSS upgrade was a *lot* of work (I’ve never used CSS before), but it was more satisfying than dealing with a pre-packaged theme and the issues most of them have.

  5. roy said, on December 28, 2006 at 1:30 am

    Only I can manage to screw this up. I managed to create a key with String instead of Integer for the first one, and now I can’t change it! ggrrr.

  6. bltz said, on January 03, 2007 at 6:52 pm

    Thank you – excellent tips and all in one page.

    Added to my ff settings. :)

  7. Connor said, on January 23, 2007 at 7:56 am

    Wow, your firefox hack is awesome. I kept watching firefox use more and more memory till it finally would crash. Very annoying and I couldn’t find a solution anywhere. Then, once I noticed how much memory firefox would use when it was active for awhile, I realized it was a memory leak. A little googling and then I discovered this blog. What a difference it’s made in Firefox’s performance. Muchas Gracias for sharing this knowledge.

  8. engtech said, on January 23, 2007 at 6:31 pm

    I’m glad you found it useful. It really is essential to getting Firefox to work.

  9. Dave Pasternack said, on January 27, 2007 at 12:39 am

    I’m suprised this isn’t better known – even among the incredibly IT-savvy people I know, they see this memory leak as an insoluble problem. I’m looking forward to sharing this article with them, as the “memory leak” is probably the most-publicized Firefox fault.

    Many grateful thanks!

  10. engtech said, on January 27, 2007 at 12:47 am

    The other big cause of memory problems with Firefox is Flash… but I think that was fixed in the latest Flash update.

  11. Greg said, on February 02, 2007 at 8:38 pm

    Of course, all of these settings, while they will reduce memory usage, will do so at the cost of speed. Caching more results will make pages load faster. If you have the RAM to space, you might not want to make these changes.

  12. Alan Grossberg said, on February 02, 2007 at 11:15 pm

    Can’t you also change the cache settings from Tools/Options/Privacy…or is that different from tweaking them in about:config?

  13. engtech said, on February 02, 2007 at 11:31 pm

    @alan:

    Tools/Options/Privacy is for clearing the cache. About:config is used for setting values for disk/memory cache.

    Different things.

  14. Michael Fremlins said, on February 02, 2007 at 11:50 pm

    There’s a problem with #2. You say “This controls how many megabytes of memory are used for the browser’s cache.” But on the Mozilla site here (http://kb.mozillazine.org/Browser.cache.memory.capacity) it says this value is kilobytes.

  15. engtech said, on February 03, 2007 at 12:21 am

    @Michael:

    Thanks for that. Corrected.

  16. tinosoft-admin said, on February 03, 2007 at 1:09 am

    thx a lot man.

    it’s all, see ya.

  17. _Jon said, on February 03, 2007 at 2:36 am

    Thanks for the suggestions.

    Can you offer a better suggestion for #2 other than “80% of the default”? If this is a new key, I don’t know what the default is. Something like what you have done for #3 would make this excellent list even better.

    Thanks

  18. Brian said, on February 03, 2007 at 2:39 am

    It is utterly ridiculous that a user should have to go through that many steps to get Firefox’s memory “under control.”

  19. sven said, on February 03, 2007 at 3:28 am

    OR you can just change:

    browser.cache.memory.leak

    from 1 to 0

  20. JoeB said, on February 03, 2007 at 3:40 am

    I hope you like looking at that huge number of unused memory in the Task Manager.

  21. engtech said, on February 03, 2007 at 4:35 am

    @Jon: The defaults are as follows. Use a smaller number.

    Physical RAM Memory Cache (in KB)
    32 MB 2048
    64 MB 4096
    128 MB 6144
    256 MB 10240
    512 MB 14336
    1 GB 18432
    2 GB 24576
    4 GB 30720
    8 GB and up 32768

    @JoeB: “I hope you like looking at that huge number of unused memory in the Task Manager.”

    Did I need to prefix this article with “only apply if you’re having memory problems”? I run a VM-Ware linux machine on my desktop that uses up all available memory. I like to keep Firefox opened for quick reference, but I want to free the memory for VM-Ware when Firefox is minimized.

  22. Alan Grossberg said, on February 03, 2007 at 4:52 am

    engtech…thanks for the reply, but I’m still confused. I’m using Firefox 1.5.0.9, and under Tools/Options/Privacy there’s a box where I can manually set the number of MB of disk space for the cache. Is that different than using about:config? Thanks.

  23. JoeB said, on February 03, 2007 at 5:30 am

    I submit that your VMWare problem is special and that ordinary Firefox users have plenty memory to spare on caching. I can’t fathom why someone would sacrifice usability for a large amount of free and unused (!) memory.

    Presenting these hacks without clearer caveats does everyone a disservice.

  24. engtech said, on February 03, 2007 at 7:57 am

    @Alan: That’s for disk cache, so it may be the same as #3.

  25. engtech said, on February 03, 2007 at 8:49 am

    @joe: This is a guide for people who have memory issues with Firefox, not a guide for people with a large amount of unused memory.

  26. […] How to fix the Firefox memory leak (Firefox hack) (tags: software) […]

  27. […] Fixing the Firefox Memory Issue […]

  28. […] How to fix the Firefox memory leak (Firefox hack) « //engtech (tags: firefox hack tips sysadmin) […]

  29. links for 2007-02-04 at DeStructUred Blog said, on February 04, 2007 at 8:11 pm

    […] How to fix the Firefox memory leak (Firefox hack) « //engtech (tags: Firefox Hack) […]

  30. […] Bu adreste bulunan yöntemlere göre düzenlemem sonucunda %30 oranında performans artışı sezdim. Firefox 2.0′ı düşük hafızalı bilgisayarlarda kullananlar için gayet güzel bir çözüm gibi görünüyor. Ozan Kilic05/02/2007           0 kez pohpohlanmış “Firefox hafıza problemine bir çözüm” başlığına kimse yorum yazmamış […]

  31. Daily Links | CreativeBits said, on February 08, 2007 at 5:27 pm

    […] How to fix the Firefox memory leak (Firefox hack) […]

  32. […] 目前最令人頭痛的問題之一,應該就是 memory leak。今天從 //engtech 看到 How to fix the Firefox memory leak […]

  33. Kreativgemüse » Memoryleaks in Firefox? said, on February 12, 2007 at 4:56 pm

    […] als man es ihm zutrauen würde… Viele Sachen kann man letztendlich abstellen, wie dieser Artikel zeigt. Naja… Fand’ ich wichtig mal zu […]

  34. Jordan Bacho said, on February 13, 2007 at 4:32 pm

    If your tips are so good then why doesn’t Mr. Firefox include them by default? I smell something fishy here.

  35. Ezzie said, on February 14, 2007 at 6:53 am

    Thanks – I’d been having a memory leak problem, hopefully this will do the trick.

  36. Ricky Bobby Joe said, on February 14, 2007 at 10:04 am

    Heh, there’s nothing fishy about this. Back before Firefox was “a gleam in someone’s eye”, Mozilla (the browser) had a similar but opposite issue. When you maximized a browser window after having it minimized for some time, it took a very long time to come up. Searching their forums way back then, I found the solution: add “config.trim_on_minimize” to about:config and set to false. These days most people have much more RAM to allocate, so the devs take advantage of that, by default.

    You can’t just type some random thing and have it affect the browser. Firefox has to recognize the entry, and if it does, that means it was designed to.

    It would be nice if they would put some sort of easily accessible Advanced Settings panel in so users could make changes to suit their preferences regarding memory usage. But given the average user, they probably feel it’s best to keep these settings hidden.

  37. Tech Tips » said, on February 21, 2007 at 4:57 am

    […] Have you noticed that Firefox can be a memory hog (still not as bad as IE7), especially when you have lots of tabs open? This might help. […]

  38. matt said, on February 27, 2007 at 2:13 am

    I made your requested changes and saw memory usage drop by about half. However since I made the changes firefox crashes on me 2-3 times per day. Since almost 90% of my work involves the use of ff I guess I am going to go back to original settings. I am using the latest version of ff and it is (unfortunately) running on windows crappy (i mean xp). Has anyone else had crashing problems after making the above changes? did you solve them with out reverting to the original firefox settings? Thanks for any help or tips.

  39. […] engtech 的文章 “How to fix the Firefox memory leak (Firefox hack)“,有五個 Firefox 的隱藏設定可減低 Firefox […]

  40. Rohen said, on March 14, 2007 at 7:35 am

    THANKS!!!

  41. […] up many results on “Firefox leaking memory”, but nothing solved my problem. I tried EngTech’s solution & couple of other solutions. More tinkering around pointed me out to a plugin, which was the […]

  42. X-J said, on March 22, 2007 at 9:34 pm

    Thank you for your great tip, my firefox works great now!!

  43. KipHT said, on March 31, 2007 at 9:21 am

    My firefox never crashes but it does use over 150MB if left un touched for hours and hours. Thanks for these tips, I hope they help

  44. visitor said, on April 18, 2007 at 8:12 am

    I have noticed that excessive CPU usage by Firefox occurs in conjunction with excessive memory usage. The “MultiMeter” downloadable sidebar gadget for Vista is helpful in monitoring this. I currently use Firefox 2.0.0.3, and it has the setting “browser.cache.disk.capacity,” but not the option “browser.cache.memory.capacity.” Anyone know why this is missing?

    PS: May I suggest that your blog entries should have dates attached to the titles?

  45. Hande said, on April 26, 2007 at 5:27 pm

    Hi,
    thanks for all the tips, I am having memory issues with firefox, it seems to “hang” at times and doesn’t react to tab changes or when writing something it just stops….
    I applied the above “hacks” but the trim on minimize doesn’t seem to do anything…. I am around 200 mb, the about:config shows that I have set true for this but still, when I minimize it doesn’t go down a bite! (I have restarted firefox and even the PC completely) Do you have any idea why this doesn’t work?

  46. award tour » firefox memory options said, on April 30, 2007 at 10:11 pm

    […] How to cahnge how much memory Firefox uses. couple interesting options you can play around with. […]

  47. […] this problem, I was quite glad to find this tutorial on how to solve the Firefox memory leak: how to fix the Firefox memory leak (Firefox hack). I followed the instructions and have been able to improve Firefox’s memory usage efficiency, […]

  48. […] searched and even this article was not able to help till much extent. Starting firefox will take the memory usage to 60k memory . […]

  49. […] : Voici deux autres liens qui peuvent aider : How to fix the Firefox memory leak (Firefox hack) reducing memory use in Firefox Encouragez-moi en soumettant cet article aux digg-like : Ces […]

  50. […] Sumber artikel dan gambar diperoleh dari situs Internet Duct Tape. […]

  51. […] been hacks to solve this problem n MozillaZine, and a summary version of the hacks can be viewed at InternetDuctTape. It is a hack, a suggestion on how to optimize memory usage of Firefox for your computer […]

  52. […] How to fix firefox memory leak (firefox hack) […]

  53. Hemat Memori Firefox « aku dan kehidupan said, on December 16, 2007 at 11:01 pm

    […] Untuk lebih lengkapnya dapat Di peroleh dari sini […]

  54. […] when Firefox crashes because of memory problems I don’t have to wait five minutes for the  error reporting dialog to pop-up. This entry […]

  55. Jay Armstrong said, on January 12, 2008 at 6:39 pm

    just another big thank you. :) FF was hitting 400 MB of memory in Windows and in Linux. With the combination of tab-mix plus, the tab-close-undo option, FF’s memory, and running ~20 tabs. I knew what was causing it but didn’t know where to fix it — now I do.

  56. firefox memory leak - Tech ARP Forums said, on January 22, 2008 at 7:00 am

    […] i hear it gets worst the more RAM you have on your system. does this happen to you? i tried this and i guess it does help it a bit. but seriously disheartening to find my RAM being eaten up so […]

  57. carmen schmidlap said, on January 30, 2008 at 12:55 am

    i don’t use firefux.it has so many
    security flaws it looks like a piece of swiss cheese

  58. […] I would run a search on this, hoping to find a solution. And luckily I did. This website explains how to fix the Firefox memory leak. Let me summarise the […]

  59. […] couple of tweaks to “temporarily solve” this issue. For those interested, you can read How to fix the Firefox memory leak with a couple of interesting […]

  60. links for 2008-02-16 -- Chip’s Quips said, on February 16, 2008 at 3:29 am

    […] How to fix the Firefox memory leak (Firefox hack) « // Internet Duct Tape Reining in the ravenous red panda (tags: firefox memory hack howto browser tips) […]

  61. Gilbert Wham said, on March 19, 2008 at 6:05 pm

    150??? Christ, I’d *love* that! Mine was using 880Mb today Eight hundred and eighty.

  62. engtech said, on March 19, 2008 at 6:33 pm

    @ Gilbert Wham:

    One person I know regularly complains about GIGs of memory being eaten up by Firefox.

    The good news is that Firefox 3 (out soon) fixes most problems.

  63. Irregular Enterprise mobile edition said, on March 22, 2008 at 8:02 pm

    […] while I’m in Mozilla flame mode, exactly when will Firefox stop leaking memory like a sieve by default and routinely bringing my machine to a grinding halt? That would be a much […]

  64. […] is your own words: And while I’m in Mozilla flame mode, exactly when will Firefox stop leaking memory like a sieve by default and routinely bringing my machine to a grinding […]

  65. Jamie said, on April 08, 2008 at 10:24 am

    Thanks for this! Firefox was up to 1,400 MB today. I was getting fed up with it. I work with ColdFusion and Dreamweaver, don’t know if the constant refreshing, multiple CSS and JS includes make it worse. But I’m very happy to see that it’s been addressed.

  66. Dave said, on April 10, 2008 at 7:50 pm

    @carmen schmidlap & maybe others

    what is it you don’t like about swiss cheese? most of them don’t have any holes at all, so it may just look as you don’t know what you’re talking about. and considering the holes iexplore definitely has, it’s all about chosing a software that suites your needs and doens’t ruin your computer as soon as you have it running (or installed? sorry if you’re running windows, because then it seems you don’t really have much of a choice or do you?)

    ps: yes I’m swiss. and I love good cheese. and maybe some people should stop eating crap that comes out of cans that only have “cheese” written on the label but has nothing to do with the real stuff (this also applies to chocolate-flavoured strawberries, blue chocolate and bright-red-but-tasteless tomatoes). if you quit buying this crap, well maybe they’ll stop selling it. oh yeah, this also applies to software.

  67. Johnny said, on May 10, 2008 at 9:52 am

    When I did this, my Firefox MB usage shot up to 70MB! Is that supposed to happen?

  68. […] How to fix the Firefox memory leak (Firefox hack) « // Internet Duct Tape config.trim_on_minimize (tags: firefox memory tips) […]

  69. Richard Watt said, on May 23, 2008 at 7:01 pm

    Wow, thanks!

    so clear and fast!

    now i`ve gotta do it to the rest of the office heheh

    Gracias compadre!

  70. engtech said, on May 26, 2008 at 9:45 am

    @ Richard Watt:

    At this point I would just wait for Firefox 3.

    Firefox 3 will fix this memory problems.

  71. […] Check this out… I have a feeling this will explain what is happening on your system…. Firefox Memory Usage __________________ Yes…. I Am Teh MeTh0Dz….. And, Yes…. I Like Teh […]

  72. jeepboy93 said, on June 02, 2008 at 12:46 am

    I found an great to get your ram usage to 30,000mb.
    go to the about:config screen like always,now find these two codes and turn them to false.

    look up this: network.http.pipelining.ssl
    network.http.pipelining

    now reboot your browser and e-mail your results to me at
    evan93333@yahoo.com

  73. […] than necessary. While there are several places that you can read up on this, I would recommend the Internet Duct Tape blog and the mozillaZine article, “Reducing Memory Usage.” I ended up changing some of […]

  74. biz888 said, on July 01, 2008 at 1:43 pm

    You are awesome! My firefox works now. I don’t mind donating to a site like this. I am very happy.
    Thank you.

  75. dai said, on July 17, 2008 at 6:54 pm

    Wow!
    Nice tips, thanks for sharing

  76. Jared said, on July 29, 2008 at 9:22 pm

    Yeah, sadly my Firefox uses well over 1GB to run a couple tabs all day. IE is so much faster for me but no unsafe so i don’t use it. I’ll be trying these tricks and see whats up, although i have 4GB of ram it’s very un nerving to see Firefox use more ram than Vista.

  77. avantgarterbelt said, on August 02, 2008 at 10:00 am

    Roy- Since no one addressed your question about incorrectly entering/naming a new preference name:

    All you have to do is r-click the value and select reset. Bounce FF and the newly-created preference name will be gone.

    Hope this helps!

  78. Larry C said, on August 18, 2008 at 4:41 pm

    #6 on my FF#3 it shows a minus 1 for this value:
    “Set browser.sessionhistory.max_total_viewers to a low number.” did you mean Set “browser.sessionhistory.max_entries.” instead???

    #2 in FF#3 there is no “browser.cache.memory.capacity”
    did you mean “browser.cache.offline.capacity” instead???

  79. […] testoasa beata. Da, de multe ori vulpita e de vina (ca sa ramanem in domeniu). Sunt si solutii: aici, aici, aici si in alte zeci de locuri. In firefox 3 problema e parca putin mai […]

  80. Anirudh Sharma said, on October 18, 2008 at 10:31 am

    You’re the guy…

    This was really helpful.. Thanks man.

  81. Jamie said, on October 23, 2008 at 7:26 pm

    WOW, SO much faster. I thought there might have been a memory leak or something weird memory wise going on with fire fox. I would have to force it to close any time it sat for a couple hours. I just made the change, so time will tell if it fixes it. However, it is many times faster when just viewing a web page. I can hardly believe it is the same computer. Thanks.

  82. Vinny said, on October 29, 2008 at 10:01 am

    These tips are great! I love firefox, but mine frequently took over 500K of memory according to the task manager. I thought the memory usage was coming from the addons, but using these tips keeps FF3 under 150K constantly. I am SO glad I found this page. Excellent!

  83. Tony H. said, on December 05, 2008 at 1:18 pm

    holy crap, this is like finding the lost city of Atlantis ! My memory usage for firefox 3.0.4 has gone from 297 meg down to 68 meg and I am loving it !

    I have 2 gigs of memory but I run many apps and while I love firefox I was about to start looking for another browser because of this problem but now I can keep using my favorite browser and it will no longer eat up my resources, thank you thank you thank you !

  84. […] Ive stopped using FF3 for the exact same reason (Mac BTW), Ive switched to Camino which based on Mozilla’s Gecko engine, uses less resources. Im going to play with the 3.1 beta for a bit and see how that fares this week. There are a few *fixes* for the memory leak by editing the about:config but they didnt make much difference for me How to fix the Firefox memory leak (Firefox hack) // Internet Duct Tape […]

  85. dll said, on December 14, 2008 at 12:50 pm

    merge ..am redus memory leak de la aprox 800mb la 130mb

  86. Randall said, on January 22, 2009 at 6:08 am

    order Aristocrat

  87. Pat said, on January 22, 2009 at 1:36 pm

    This was a life saver. When Firefox was running I was routinely using 52% ram. It got worse as it sat and sometimes just clicking the mouse would take it to 100%. Closing the program did not free it up. Since making your changes, I just hit 11%. What a difference.

  88. Amior said, on February 12, 2009 at 9:52 am

    Thanks :)

    that’s good news….

  89. harimansite said, on February 20, 2009 at 9:26 am

    thank’s bro, i will try it

  90. karlzt said, on February 21, 2009 at 4:22 pm

    since this is old i ask: is this outdated?

  91. D: said, on February 22, 2009 at 11:54 pm

    for some reason my config doesn’t have browser.cache.memory.capacity? o w o;;

    ahhhh. = w =

  92. nickvisel said, on February 26, 2009 at 9:05 pm

    Thanks for the info!

  93. NettiCat said, on March 08, 2009 at 12:52 pm

    Did not reduce the hogged memory.
    In no way.

  94. Burma said, on April 23, 2009 at 9:50 am

    Thanks,bro.
    Firefox becomes suck and suck these days partly due to addons.

  95. dig said, on April 24, 2009 at 9:05 am

    TX

    D: YOu make one

  96. Bodsda said, on April 30, 2009 at 3:15 am

    Hey dude, thanks a lot for this post. I’m running fluxbox over here cause I want everything to be fast, I only have a gigs worth of ram so firefox usually clogs most of it, thankfully youve helped to reduce the load and speed up my firefox, cheers dude :)

  97. sağlık said, on April 12, 2010 at 11:43 am

    Did not reduce the hogged memory…

  98. Ronald said, on November 14, 2010 at 5:31 pm

    Agree with you.

    SOmetimes we might forgot what the basic.

    Thanks, man.


Comments are closed.

%d bloggers like this: