SEARCH

How-To Geek

HTG Explains: Do Firefox Memory Cleaners Actually Work?

image

It is no secret that Firefox can consume quite a bit of system memory during normal usage. While the number of tabs you have open and the installed add-ons certainly contribute, even a conservatively used out of the box installation can report quite a bit of memory usage.

This has caused a few Firefox add-ons to surface which claim to free up memory the browser no longer needs, but do they actually work?

A Two Minute Overview on How Windows Handles Memory

image

Before we dive into examining a memory cleaner, it is important to understand a little bit about the way Windows handles memory. This will be important so we can interpret the results of our experiment.

Don’t worry, we will cover this at a very high level so you don’t have to be a mega-geek to follow along.

As a quick disclaimer, this is an extremely brief summary of the very basics of Windows memory management. By no means should this be considered authoritative or definitive as it is only explained to level applicable to the subject matter of this article.

Windows is smart enough to know that unused physical memory is wasted memory, so it loads everything it needs and thinks it will need into memory. However, only what your system actually needs (both Windows and applications) and is actively using at the current time is reported as used physical memory. The rest (what Windows thinks it will need) resides in what is called virtual memory.

Virtual memory is essentially the data which is not actively required by the OS but is ready to be loaded into active memory at any time. You can very crudely calculate the amount of virtual memory your system has at any one time using this formula:

Virtual Memory = (Total Physical Memory – Used/Active Physical Memory) + Maximum System Page File Size

So, suppose you have a system with 4 GB of physical memory and a 6 GB maximum page file. You then boot up Windows and open a few applications (Outlook, Firefox, etc.) and Windows reports that 2.5 GB of physical memory is being used. This means you have 1.5 GB of “unused” physical memory and a 6 GB page file for a total of 7.5 GB of available virtual memory.

Remember, the OS is smart enough to know that unused physical memory is wasted memory, so it will fill the remaining 1.5 of physical memory with what it anticipates you will need so it can be accessed on demand almost instantaneously. This can be anything from minimized background program data to common OS functions.

So what happens when Windows runs out of physical memory to use as virtual memory? It writes this data to the system page file which is a huge (in our case 6 GB) file on your hard drive. While this allows for the OS to store pretty much any data it needs to keep in memory, writing and retrieving (aka a page fault) this information to/from the hard drive is orders of magnitude slower than accessing it from physical memory. This is why the more physical memory you have the faster your system can run. The less your system uses its page file, the faster it will perform.

Monitoring Firefox’s Memory Usage

For our investigation we will simply be using Windows Task Manager. We will be tracking the following columns (the descriptions are defined on Microsoft’s page):

  • Working Set = Amount of memory in the private working set plus the amount of memory the process is using that can be shared by other processes.
  • Peak Working Set = Maximum amount of working set memory used by the process.
  • Memory (Private Working Set) = Subset of working set that specifically describes the amount of memory a process is using that cannot be shared by other processes.
  • Commit Size = Amount of virtual memory that is reserved for use by a process.

image

We will be using an out of the box installation of Firefox 4.0.1 with only the Memory Fox add-on loaded. In Firefox, we will have the following tabs open and will not do anything other than scroll up and down the loaded pages.

image

After waiting a few moments for everything to finish loading, Windows Task Manager reports the following for Firefox.

image

Now when we start the Memory Fox add-on, look at the dramatic drop in the amount of reported memory use.

image

Also take note that a new process is started by this add-on which is what handles the memory functions.

image

Leaving Firefox idle and watching the Working Set and Memory values, you can see there is a constant struggle between Firefox needing active physical memory and the memory cleaner add-on reclaiming this memory.

Here is the reported memory usage taken every few seconds while Firefox is left idle.

image

image

Note the drop in the Working Set and Memory values. This the is memory cleaner reclaiming the system memory.

image

image

image

After going up for a bit, you can see another drop.

image

image

image

Lather. Rinse. Repeat.

Additionally, if you do nothing but switch tabs and scroll up and down the loaded pages, you can see the numbers fluctuate a bit more drastically which will be explained below.

Interpreting the Results

When you first look it, you would think, hey this is working great. But take a look at the Commit Size column and you can see that this value never really changes. In fact is goes up once you start the memory cleaning add-on.

Remember, the Commit Size column reports the actual amount of memory (physical + virtual) Windows needs to run the respective application. So in our example, the ~120 MB is reserved and active on the system specifically for Firefox and is residing in either unused physical memory and/or the system page file. Also remember that if the page file needs to be used, there is a noticeable performance impact because the virtual memory has to be written to and read from the hard disk which is significantly slower than physical memory.

So essentially the memory cleaner is moving active physical memory to virtual memory (because the memory is reclaims has to go somewhere). When this happens, Firefox no longer has the memory it needs to function actively available so it has to ask Windows to move the respective data it needs from virtual memory back to physical memory.  And around and round we go…

At best, this process does nothing useful at all and at worst it causes a massive amount of unneeded page faults because, again, if Windows has to bring the page file into play then there is going to a noticeable performance hit. This can especially be the case on system which do not have much physical memory (where pretty much all virtual memory is kept in a page file), which is ironic because these are the systems a memory cleaner was “designed” for.

The moral of this whole story is quite simply, memory cleaners do nothing but shift around numbers. Any OS is going to know how to handle memory appropriately, so just let them do their thing.

Managing Firefox’s Memory Usage

Since we have shown that memory cleaning add-ons do not really do anything useful, what can you do about the large amount of memory Firefox uses? Here are a few suggestions:

  • Remove add-ons you don’t need (especially any memory cleaning ones).
  • Keep the number of tabs you have open to a minimum.
  • Periodically close Firefox and relaunch it.
  • Add more memory to your system.
  • Don’t worry about it.

Memory Fox Add-on for Firefox

Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 05/6/11

Comments (43)

  1. bkj216

    The only way to deal with Memory Leaks in FF is to 1 – Buy more RAM, 2 – Deal with it and just accept that FF has memory leaks and it will occasionally slow down, 3 – Switch to Chrome (which also has memory leaks but doesn’t slow down as much).

  2. Edrei

    HTG you’re reading my mind. I in fact just installed Memory Fox a few hours ago because Firefox 4 seems to be eating a chunk of my RAM after 24 hours of use. This morning alone, it used up 2.6gigs of memory after being open for 24 hours. It’s consuming more RAM than FF3.5 ever did.

    Although, FF3.5 had a massive slowdown after consuming that much RAM. FF4 for some reason still runs smoothly despite the massive memory leak.

    I thought that the memory fox addon would solve the problem, but this article says otherwise. I guess I have to get used to restarting Firefox every day. I much prefer to keep it open on my 24 rig, but not at the cost of memory munching.

  3. Hatryst

    ” Remove add-ons you don’t need (especially any memory cleaning ones) ”
    Best solution ever !! :D

    (or use Chrome !)

  4. Anon

    Cool subject. Great explanation.

    Addon reminded me of the old XP days using FreeRAM XP with 512mb or 1gig of ram.

  5. cam2644

    Periodic relaunch is the most sure answer. I don’t think this is a Firefox only problem.

  6. Alan

    This article misses one important point, that being that FF memory moved to the hard drive is available for other applications. So in a low memory situation the other applications will have more physical memory to work with. This seems like an advantage, even though it may slow FF down just a bit?

  7. Steve

    I have a bad habit of keeping many tabs open and finally got tired of FF bogging my system down. I now use Chrome exclusively and don’t have any of the memory issues I had with FF.

  8. Demetre

    FireFox has become exactly what FF was first created to solve !

    It has become heavy, memory guzzling, slow, and incredibly unstable !

    Buying RAM is not a realistic solution to the memory problems of FF. Having
    it redesigned with simplicity in mind is the solution. I hope the developers rediscover their
    original intentions and work from there to re-develop FF.

  9. M Henri Day

    Thanks for this valuable article ! May I ask if, e g, Linux distros like Ubuntu handle memory in the same manner and if, therefore, this article also pertains to them ?…

    Henri

  10. Davey126

    I do not use FF (Chrome fanboy) or the extension but I have tinkered various ‘memory managers’ most of which do exactly as described in this article. That said, depending on how the extension is coded (which APIs are called) and what else is going on with the system it is possible excess FF pages are simply moved to the ‘standby list’ which also resides in system memory. Techs can find a better explanation here:

    http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/MemorySizingGuidanceWin7.docx

    In general I find Vista/Win7 do a pretty good job managing memory on their own. In most cases it’s best to let Microsoft do the heavy lifting :)

  11. Paulo Cezar

    Great article. I haven´t used these Firefox memory managers but I keep the free Analogx MaxMem utility open all the time. You set a threshold and it will only act when needed.

  12. Jason Faulkner

    @Alan – One thing to note though is FF starts reclaiming memory almost immediately after it is moved. So while your thought is correct in theory, in actuality you are just going to create a unnecessary constant shifting of memory between the OS and applications. Just leave this up to Windows.

    @M Henri Day – I don’t know the specifics on how Linux handles memory, but my guess is the overall process is going to be very similar.

  13. Kevalin

    A number of folks here have extolled the virtues of Chrome, but I have to say I’m not sure why. My experience with Chrome is that it’s often at least as slow as Firefox, only without the funand useful addons (excluding the memory “savers,” thank you). Also their far greater tendency to gather data you would rather not share with Google, Inc. and its advertisers, with very few options for blocking it, make Chrome very annoying. This lack of speed difference, mind, is on a very decent gaming computer with substantial ram.

    While Firefox can and does get on my nerves, the privacy/speed issues I experience with Chrome preclude my using it as anything but a secondary browser. Indeed, I’ll often go with Opera before I’ll settle for Chrome, if Firefox is being really snotty. But mostly, I just stay with Firefox.

  14. Duncan

    Okay, first @Demetre: FF has gotten bigger, it’s true, but it still isn’t nearly as heavy, memory guzzling, slow, or unstable as IE is, so it’s still my browser of choice.

    Second, I have my FF set to show my windows and tabs from last time when i start it. Does this undermine the periodic relaunch fix?

  15. RobCr

    My PCs are old (Dec 2003)
    They clunked along, because I keep many FF Tabs open.
    The solution is URL Gather which is free, and portable (No Install)
    http://www.zqware.com/urlgather.htm
    It has a treeview on the left, where you create Folders, and sub folders.
    You can then insert the url for the desired web site, give it a Name, and an optional comment.
    You then close your open Tab, as URL Gather will now remember it for you.
    Whenever you relapse (accumulate too many Tabs), you just spring clean them into URL Gather.
    It has been a godsend for me.
    Rob

  16. mark

    try cleanmem.exe, small footprint, works quickly

  17. tiptop43

    from what i’ve just read i’m not going to ugrade to four i’ll stay with and use 3.6 ff if i’m wrong pleese someone tell me why ,,,,,, im toshiba vista memory 4gb’s ….225 space and toshiba made a HUGE point of telling us to NEVER EVER UPGRADE to ie8 i wonder if that holds for ie9 but they wont tell you without charging you lol…. so should i sjust stay with 3.6 ff i use chrome a LOT anyhoo
    thanks guys…. any thoughts would be really appreciated

  18. Bob Pratt

    Firefox is losing its way for me, bloated, complicated and screws up what memory I have. I changed to Opera and am only kicking myself that I didn’t do it ages ago.

  19. btcoyle

    The foolproof way to thwart FireFox memory usage problem is to NOT USE FIREFOX.

  20. kv

    To me. momory cleaners like cleanmem and iobit’s smart ram is useful to compress memory usage of ALL processes, not just one. To me, they work great compared to a system without them!

  21. onedeafeye

    I have x64 Vista with an i7 chip and 6GB of RAM. Would there be any advantage or disadvantage to turning page file off altogether?

  22. Jason Faulkner

    @onedeafeye – It would be ideal if you could do this. With servers it is recommended to have enough physical RAM to where you never have to use the page file at all.

  23. Chronno S. Trigger

    @Jason Faulkner – And then you run into problems with BSOD. Never run without a paging file, Windows has it for a reason. Linux may be different, but I’m sure it creates a partition exclusively for the paging file for it’s own reasons. Even on systems with 6+ G of RAM, it’s a known issue that a small paging file will slow the system down.

  24. quags

    @Kevalin (and other fans of chrome)

    If your worried about the privacy issues of chrome, you should have a look at the Comodo Dragon browser. It is basically Chrome sans Google, with some added security. Its built on the same chromium browser engine(chromium) as chrome so the same plugins work.

    http://www.comodo.com/home/browsers-toolbars/browser.php

  25. grayhoose

    my FireFox is just as fast as Iron on startup, run Boinc 24/7 with 8gb ram and sometime it uses 6gb with no slowdown. don’t see how this is a problem.

  26. Chris

    Any ideas on the plugin-container.exe? Has that been taken into account with the memory usage? And do the memory cleaner add-ons have any effects on plugin-container.exe’s memory usage?

  27. Chris

    Sorry, forgot to say that I did enjoy the article, plugin-container or no plugin-container :)

  28. keltari

    @Jason Faulkner – windows needs the pagefile to operate properly in case of a dump. Also, the page file is there for a reason! Your computer will operate better with a pagefile! Windows moves data in memory that is not being actively used to the pagefile, thereby allowing more memory available to the active processes. No page file means less memory is available to the applications needing it.

  29. Tek9

    For all the questions regarding Linux, yes it handles memory similarly to windows. It’s referred to as a swap space. Unlike windows pagefile though, the swap space in linux is typically its own partition on the hard drive, rather than able to re-size “on the fly” like the Windows pagefile. I’m unsure of whether firefox memory issues are addressed more efficiently in linux vs windows, I typically deal with linux from a command line standpoint only.

  30. Erik

    I’m surprised no one has mentioned the actual fix to FireFox’s memory issue. You open up FireFox’s advanced settings and you setup specific memory usage limitations that force it to actually do garbage clean up to stay under that amount of memory usage. Doesn’t require an add-on or an external memory manager program.

  31. BIGDOG76

    @ERIK, I think you are thinking of the offline cache, not the same thing, but good Idea to limit its size (~32 MB), as that will eventually effect system and FF performance.

    Linux Swap and Windows PageFile are very similar. I would not recommend allowing your page file to auto resize. Linux does not offer that feature. Linux does handle Physical Memory usage differently.

    I am writing this on an Optiplex 270 P4 with 1GB of DDR RAM and have no performance issues with FF4 and 5 tabs open. I often have 6+ tabs open and still rarely have a problem. Set up your system right and maintain Windows (the real area of performance problem) and you should be fine.

  32. Robert Pickering

    How to check computer for errors: scan clean and repair your registry remove malware spyware viruses make your computer faster how to check computer.

  33. Gregory

    If an issue for your usage and computer configuration, then I suggest try Opera Browser

  34. keltari

    I had switched to Firefox from IE and loved it. However it got big, bloated, and slow. And the latest version is ugly. I switched to Chrome a year ago and love it. I tried the latest version of Opera recently and its just is ugly as firefox and retardedly slow.

  35. Richard Bishop

    One of the first things you learn with IT training … Memory Cleaners do not work. They have been a software scam for nearly 20 years. Firefox works great without a bunch of useless add-ons. You couldn’t pay me to use Chrome, because the Google Updater is “Nazi Opportunistic” … And to be truthful, Chrome is junkware. HTG, you did a great job in explaining the “why?” of Why Memory Cleaners Don’t Work. The process of cleaning memory, uses more memory than what it was meant to clean.

  36. Doz

    This is the kind of excellent article I look for from HTG.

  37. Jason Faulkner

    You can run a Windows system without a page file. As an experiment, I have done it on servers with 16 GB of RAM. Granted I knew what these servers were going to be running and the 16 GB cap would not be reached.
    That said, you can certainly do it on desktop machines if you have enough physical memory, but you shouldn’t do it haphazardly or if you have a relatively small amount of memory or your usage pattern could change. I wouldn’t even consider it unless I had 10+ GB of physical RAM and knew exactly how I was going to use my machine.
    As a general rule, however, just leave the page file there because it doesn’t take up much space (relatively) even if it doesn’t get used.

    Regarding the plugin-container, this is actually considered a separate process so the memory cleaner doesn’t really touch it.

  38. BallyIrish

    Hi Geek. Your article was too simple for my large brain for me to grasp – properly. I therefore like yoyr last suggestion “Don’t worry about it.” It’s sage and meaningful. Great idea! Thanks

  39. Magyver

    Would you guys believe I keep over 250 windows up at all time in FF and it’s never slow? True. My CPU never knows they’re there.

    You guys who left FF never found the 2 most important add-ons: Bar Tab and Flash Blocker.

    Explanation: I’m a professional NFL writer with articles syndicated across 34 sites now, plus I have my own Saints site magazine. I could not function without all those 250 windows. Every single sports news agency I need for reference is up there 24/7.

    BUT… My CPU only sees the one I click on to use. If I click a second one, 60 seconds later the first page is disconnected from the CPU. Bar Tab does that. as I move from page to page, Bar Tab disconnects the other pages.

    Flash Blocker effectively disconnects ALL flash based advertising from any site I open. That alone is great. I do all this with a $300 laptop with Windows 7 and only 2 GB memory.

    IMPORTANT: You must close FF with Task Manager by “ending Process” to make all those windows boot up each time you reboot FF. When you reboot FF, you’ll get a page that has you click to restore all your tabs. If you close FF with the red X, you lose your tabs the next time. You have to start a new session.

    Yes, it works, and it works very well.

    I was doing the same thing with an aging XP with a half GIG memory, often having as many as 500 tabs.

    LAST BUT NOT LEAST: Use the FF Tools function to clear history every couple of weeks to clean up temp files; do the same thing for IE with a cleanup program.

    And restart the computer off every day or two, that clears your virtual memory. With the old XP I did that twice a day.

  40. TheZeDD

    Google Chrome…. for a company like Google I’m almost surprised they didn’t re-write the software themselves for the last two Nuke reactor incidents. Well, then again, all Fukie needed was a waterproof connection by the sounds of it.

    Technically speaking, Opera has had a lot going since its inception… its getting to be too much going for it. But, every body needs their own unique glitches, just re-written I guess :/

    A slim down version i guess is in the making :)

    JAVA — say it a couple times. Its memory intensive. I think its a great tool its just not resource friendly. Interoprability I think was another issue.

    With all the background gump in a working inepted system, there’s much that has been done to clean it all up….

    If there was less problematic issues we would all have it much better too. Theres a lot of resources that get wasted tasking elsewhere or circumventing one item to have another fall thru or open up too.

    Memory cleaners have always been looked upon as problematic if any by nature of evolution and more hidden gump.

    *shrug* but dont ask me… i have no clue.

    ———-> <———-

  41. RYan

    I hate FF but my wife loves it. The worst part is when she uses then leaves it open and I hear my laptop having a fit because it sucks the resources DRY. Fans going full blast cuz FF is eating my laptop alive! Yeah I could get a new laptop OR FF could not suck? I use IE9 and its fast and runs well no issues what so ever. All you IE haters need to get over the days when IE was the worst thing to come out of web browsers back in the IE5/IE6 days. IE9 Rocks.

  42. Chris

    @RYan, I must admit I’m a bit shocked to be browsing a geek website and seeing a reader (geek?) post that “IE9 Rocks.” :) Most geeks would jump down your throat for laying any such claim to a Microsoft product, even if only in jest. :)

    I must also admit though, in my minimal usage of IE9 (I currently run Ubuntu’s latest and greatest and only reluctantly use IE* in VM’s because I’m a web programmer and have a few end users like yourself with IE needs), that it is still just as much of a pain for programmers to deal with as previous versions of IE. End users may not understand why, but after spending roughly 5 years as a full out web programmer, IE does not rock no matter what version is in question (especially when compared to FF or Chrome).

    But, Microsoft does offer lots of cool features for non-geek end users, who just want something that (usually ;) ) works. I write my own opinion mostly poking at IE’ers just in jest. So happy IE9′ing to you, I’ll stick with FF and Ubuntu!

  43. QuTox

    While most of what this article says is true, it does not address the problem of memory leaks, and therefore draws an invalid and misleading conclusion that memory cleaners (specifically Memory Fox) are useless. Although Memory Fox is not a permanent solution to FF memory hogging and memory leaks, it helps a great deal.

    Memory Fox is set up to dynamically and constantly flush the computer memory’s resources to optimize memory performance. By doing this the problem of programs consuming more memory over a period of time is largely avoided (including idling). To do that Memory Fox has to be configured to activate for all processes, not just FF. It also operates as an external process separate from FF, so you don’t need to have FF open for it to work once activated.

    The only catch is when it’s first installed, it has to be manually activated, or it won’t do anything. Immediately after installing the Memory Fox addon, there has been a significant improvement in memory usage, more physical memory is freed up, and overall handling of memory is much better than before.

Enter Your Email Here to Get Access for Free:

Go check your email!