How to fix Firefox memory leak?

2

My firefox has been continually leaking memory for years now (as in, it started several versions back, currently on 42.0). At some point, when it reaches the 2.2GB mark, it starts having rendering glitches and then crashes out eventually with a message indicating that GDI failed to allocate new memory.

Things I have tried to solve this:

  • Disable all addons
  • Create a new user profile
  • Uninstall and reinstall
  • Uninstall, delete all Mozilla folders from AppData, reinstall

However, none of these fixed the issue.

The only thing that seems to help is to run Firefox in safe-mode, but that is a very inconvenient thing to do.

Firefoxes on other machines synced to the same profile do not exhibit this behaviour.

What else can I do to try and resolve this annoying problem?


Update 2016-07-10
I have now switched to the 64-bit Windows build, which delays the rendering glitches until closer to the 4GB mark. It also stays longer between 1 and 2 GB with this build, but will eventually run above.

I have also disabled a windows titlebar addon in an attempt to find causes outside of Firefox, so far without success.

Here is an about:memory profile at 1.4GB: http://pastebin.com/zBCRaWEG


Update 2016-07-30
After upgrading from Windows 7 to Windows 10 the leak seems to be fixed (for now). Memory usage is stable between 600 MB and 1100 MB (which might have to do with the amount of tabs and addons I use).

This leads me to believe that a faulty (possibly outdated) driver or system library was the culprit - although I can't tell which one in hindsight.

I'm leaving the question open for actual, factual answers, just in case.


Update 2016-08-13
After the update that disabled custom add-ons I had to change to Firefox Developer Edition (FDE) (64-bit, with electrolysis enabled) and the memory leak seems to be back (FDE will accumulate about 2GB of memory split between its two processes within a few days), additionally with another issue that sporadically occurs, which is FDE refusing to render any and all webpages (even the ones already loaded) and just displaying a white page with a loading indicator in the middle. This problem, to me, appears very similar to the problem I originally described, where Firefox had trouble rendering UI elements when it was about to run out of memory.

Cobra_Fast

Posted 2015-12-16T10:04:59.383

Reputation: 215

1And could it be the case that it depends on the websites you visit? I'm pretty sure many JavaScript and Flash implementations keep references to large unused memory objects if you keep the tab open for some time. – Run CMD – 2015-12-16T10:16:39.443

1@ClassStacker I have Flash disabled by default, but I do indeed have two pinned tabs that make good use of JavaScript. I will try it by closing those. – Cobra_Fast – 2015-12-16T10:20:09.290

1I presume Silverlight etc may actually have the same issue, also Java applets (not very common today). Garbage collector or not, it can't collect the garbage unless the implementation frees the reference. With all the AJAX stuff out there, the life span of objects has advanced into new dimensions; anchor HTML artefacts such as frames are used for keeping data, and changing the page (where the browser can throw away the objects) has been replaced by dynamically loading new content, such that the implementation itself must do some housekeeping... "if in doubt, keep that reference"... ;) – Run CMD – 2015-12-16T10:24:36.637

1when you see the high memory usage run about:memory, click on measure. Copy paste it to pastebin and post the link to pastebin here. – magicandre1981 – 2015-12-16T16:27:33.730

1

How many tabs do you have open? I hit the 2GB limit when I have 150+ tabs open. In other news FF 64bit is now available...

– Burgi – 2015-12-17T16:52:16.067

1@Burgi I don't think it's a question of how many, but for how long. I have several tabs I don't close for days or weeks even (I'm a standby person, not shutdown). I still want to wait a little longer before I can be sure about any differences without those tabs though. – Cobra_Fast – 2015-12-17T21:14:21.363

1Have you see the high mem usage again? have you tried to run about:memory? – magicandre1981 – 2015-12-18T17:01:18.930

1I have now found out that in safe-mode, the issue is not present or by far less bad. I have also found out that Firefox will not free up any VRAM it allocates ever (only on restart). I have also found out that I can provoke very high system- and video-memory usage by browsing Google Maps for a bit. – Cobra_Fast – 2015-12-19T13:50:26.087

I also prefer using standby/suspend/sleep mode to shutting down systems. I also tend to have several browser windows with many tabs open after weeks of use. I've had problems with browser memory and CPU usage by Firefox on Windows, Linux, and OS X. But I find similar problems on other browsers, also. Though with Chrome and Safari it is easier to isolate the problem to particular tabs.

– moonpoint – 2015-12-19T15:40:26.313

Do the systems synchronized to the same profile that don't have the problem have more memory? – moonpoint – 2015-12-19T15:52:29.737

without the data from about:memory I can't help you – magicandre1981 – 2015-12-19T17:03:15.683

@moonpoint No, the other systems have much less memory. – Cobra_Fast – 2015-12-19T19:38:15.450

were you able to get the about:memory data, wenn Firefox was using so much RAM? – magicandre1981 – 2015-12-24T07:42:52.050

You said you disabled add-ons. But did you also disable plug ins? – None – 2016-08-13T03:17:54.670

The other thing you might try is install an add blocker. It might be some ad networks are causing the crash. – None – 2016-08-13T03:20:57.730

@user576053 I have been using uBlock Origin for quite a while already. – Cobra_Fast – 2016-08-13T14:58:41.677

In my experience, ad blockers like AdBlockPlus and uBlock are the ones that use the most memory. I have tried browsing without ad blockers and it took much longer for the memory usage to ramp up. I heard the ABP memory issue was fixed in FireFox 41 but I have not seen any material impact. – some user – 2017-01-17T19:21:02.550

There is also memory leak issue with the latest version 52.0.1. I installed Firefox on a Windows 7 32-bit virtual machine. When the memory used by Firefox grows up to 1GB, I close all web pages but that won't stop the memory from continuously growing. – Durfee – 2017-03-30T01:08:24.113

No answers