15

I am primarily using Firefox as my web browser. I have noticed that after some tabs having been opened and closed the memory usage of Firefox becomes larger and larger.

This fact often leads me to crash it (deliberately using the task manager) and to open it again selecting only some of the tabs I need. There are cases where I open all my previously open tabs. The funny thing is that even in this case, the memory usage is by far less than what it was before shutting Firefox down.

So my question is why is this happening? Why does the closing of the tabs not help (at least not that much)? Is there a way to reduce the memory usage without shutting Firefox down?

9
  • 1
    When you say "memory", what precisely do you mean? Resident set size? Commit charge? Virtual address size? How are you measuring and what operating system are you using? Also, why do you deliberately crash it? Are you having some kind of actual issue? Or do you prefer that RAM be wasted than used? Jul 29, 2014 at 9:32
  • 1
    Sorry, about the missing information. I am using win7, I am referring to RAM memory, I am measuring simply observing the task manager tab so the memory estimation may not be too accurate. The fact is that firefox sometimes uses upto 2Gb of memory which does not seem reasonable for the number and content of tabs being open.
    – Eypros
    Jul 29, 2014 at 9:45
  • Which tab --"Working Set (Memory)"? Jul 29, 2014 at 10:04
  • 1
    I can recommend small addon that allow restart firefox in easy way. addons.mozilla.org/ru/firefox/addon/restartless-restart Dec 21, 2014 at 12:00
  • 1
    Possible duplicate of Is there a way to reduce the memory usage of Firefox? Feb 28, 2018 at 20:38

4 Answers 4

6

Enter about:memory in the address bar. Click 'Minimize memory usage'.

https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-ram

3
  • +1. I don't know if it will solve all my problem but it was useful anyway, so thanks.
    – Eypros
    Jul 29, 2014 at 9:49
  • 9
    This completely fails to answer the primary question asked. "Why does my Firefox memory usage keep rising with use and never returns to the initial level?" Jul 29, 2014 at 10:48
  • And, by the way, you would only want to do this if you were testing or benchmarking. It just forces your system to waste memory that it was using, even if it doesn't need to. (It does it automatically if it needs to, the people who write Firefox aren't stupid and wouldn't make you senselessly hit a well-hidden switch just to get things to work better.) Jul 29, 2014 at 10:48
5

The first thing I would suspect is that some of plug-ins leak memory or use it a lot.

For example, AdBlock Plus often causes Firefox to increase memory usage significantly. The reason is that it injects large style sheets into every frame. (Ghostery is a more memory-efficient alternative, although it serves a different purpose.)

So, as suggested in the comments, if memory usage doesn't seem reasonable, try disabling all plug-ins and see if this helps.

2
2

If you need the RAM for other purposes, just restart Firefox. It will minimize it's memory usage, too.

You can even say to Firefox that it does not have to load all pages upon restart:

Firefox button -> Options -> Tabs -> Don't load tabs until selected

Also, I have noticed a high memory usage from Adblock Plus. Adblock Edge does not seem to have this issue. Disabling Adblock Plus also frees memory.

0

RAM cannot be saved for later. Your only choices are to use it or waste it. A system with 8GB of RAM can't use 4GB today in order to use 12GB tomorrow.

So, simply put, Firefox is using more memory because the alternative would be to waste that memory. It is not returning to the initial level because it would take effort to do so and there would be no benefit to expending that effort.

The fact is that firefox sometimes uses upto 2Gb of memory which does not seem reasonable for the number and content of tabs being open.

It's perfectly reasonable if the alternative is to have some of that RAM be wasted and holding no data whatsoever. At a minimum, it allows Firefox to use up to 2GB of memory without having to allocate any more memory, which is a win. Freeing and allocating memory takes effort. Smart systems only expend effort when there's some expected benefit. They certainly don't do work that they'll probably just have to undo later.

Modern operating systems go out of their way to have as little free RAM as possible. Free RAM is forever wasted. If you had 1GB free for the last hour, you gained no benefit whatsoever from that 1GB in that past hour. If you're thinking, "I want that RAM free now so I can use it later", forget it. You can use it now and use it later. There's no painful tradeoff to make here.

38
  • 7
    Maybe we are entering a philosophical conversation about what is useful. From my point of view I cannot use the memory holding "possibly useful information" as you mentioned since it's allocated by firefox. So I could just get an out of memory message from other application I am using.
    – Eypros
    Jul 29, 2014 at 9:58
  • 5
    @DavidSchwartz: this is complete nonsense. what the hell is "directly transition the memory"? if memory is scarce, one application has to give so another can take (the alternative is the dreaded swapping..). "Modern operating systems do this very efficiently" - do what?? they can get rid of code and library pages because they can be re-fected, they can play with the FS cache pages, but cannot take away memory that's normally used (e.g.: firefox storing a closed tab or images so they can be opened faster). Jan 20, 2015 at 11:09
  • 11
    -1 for exactly the same reason as @KarolyHorvath. On a 4 GB machine (which is only "less-that-average" nowadays), FF taking 2.5 GB of resident memory (I'm on Linux) is unreasonable, because it takes memory away from other applications. When I close several tabs, I expect FF to release the now unused memory, so that other applications, or the kernel itself for that matter (which likes to cache aggressively, greatly increasing overall performance) can use it. This is the archetypal developer/sysadmin dispute, if you don't need the memory anymore, release it, you're not alone on that system.
    – MoonSweep
    Apr 19, 2015 at 22:02
  • 8
    Downvote for one of the stupidest ideas around: "Let's waste memory for fear it will go unused" May 11, 2015 at 20:26
  • 7
    You seem to be arguing that it's okay for Firefox to bloat up to 2Gb because that memory is just swap and so other programs are not prevented from having that 2Gb. This is false. Most of that 2Gb is dirty pages which have to be flushed. Out. Moreover, when Firefox decides to run some garbage collection on that cruft, it has to be paged back in: and that will happen in some random order that causes seeks all over the place on a conventional spinning hard drive. Not writing 2Gb to disk and reading it back is demonstrably more performant than doing so.
    – Kaz
    Aug 12, 2015 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.