Closed Bug 652801 Opened 13 years ago Closed 13 years ago

Major memory leak - the longer firefox is left open, the more memory it uses

Categories

(Firefox :: General, defect)

4.0 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 666101

People

(Reporter: qisheng.zhao, Unassigned)

Details

(Keywords: memory-leak)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0b12) Gecko/20110226 Firefox/4.0b12
Build Identifier: Mozilla/5.0

  

Reproducible: Always

Steps to Reproduce:
1.open firefox in safe mode, thne open several sites, say finance.sina.com.cn/stock , or any other sina.com.cn pages
2.left firfox open, no any other actions
3.15 or 30 minutes later, in the windowns's task manager, could see the larger
and larger memeory ocuppied when time goes by.
4.if left fx open the whole night. its memory will be 1.7G....

Actual Results:  
Major memory leak - the longer firefox is left open, the more memory it uses 

Expected Results:  
no memory leak.

the test I did with fx in safe mode, that is without any addon, plugin, prefs.
my Graphics
      
      
      
Adapter DescriptionNVIDIA NVS 3100M
Vendor ID10de
Device ID0a6c
Adapter RAM512
Adapter Driver
snvd3dum nvwgf2um,nvwgf2um
Driver Version8.17.12.5738
Driver Date6-27-2010
Direct2D Enabled false
DirectWrite Enabled false (6.1.7600.16763, font cache 8.88 MB)WebGL RendererGoogle Inc. -- ANGLE -- OpenGL ES 2.0 (ANGLE 0.0.0.541)GPU Accelerated Windows0/1
this bug is serious in fx4.0, but few in fx4 beta12.........
Thanks for testing in safe-mode! That eliminates the possibility that it's a leaky add-on causing the problem.

Do you get the memory back if you navigate to a new site in the open tab? Do you get the memory back if you close that tab (while another simple tab is still open -- don't mean to shut down the browser)?
Group: core-security
Keywords: mlk
when open a site in the open tab, get the memory back, maybe from 1.7G to 900M, and becomes laggy..
Version: unspecified → 4.0 Branch
Hi I have the same bug but with windows 7 64bit.

Initially I installed firefox 4 as a complete clean installation on a freshly installed windows, there was no previous firefox and as such also no previous profile.

I loaded up around 10 sites, used the browser for a bit and then left the system idle for a day or two.

When I came back firefox was using over 3 gig of memory.  During all this there was no plugins/addons installed other than the defaults.  The only preferences I had changed was the cookie settings.

I then managed to get bartab installed to help me diagnose the problem to see if a particular website was the cause but unfortenatly it seems to be no particular site, with all tabs loaded in memory and leave for a day or so, the memory usage is high, if I then forcefully unload a tab with bartab the memory goes all the way back down to about 300meg (Same as startup), if I then leave firefox again for a day or so the memory however goes back up and it then comes back if I unload the next displayed tab.  So it seems simply unloading the current tab on display recovers the memory, this suggests background tabs are not leaking but the tab in focus is.

In addition if I leave firefox open enough it will eventually crash, I sent of the crash report last week, firefox which was left for about a week crashed when using 7.8gig of memory, the system has 8 gig including virtual memory and the crash report said firefox.exe was using 90% of it when crashed.

Ever since I started using firefox I would say this is easily the worst memory leak I have seen and am able to repeat it on 3 different systems on a clean installation with a clean profile.  This to me makes v4 unusable as on my production system firefox v3 has over 200 tabs loaded at any given time, so if I am getting that kind of memory leak with just 10 tabs it clearly isnt usable for me on 200 tabs so until this problem is fixed I have to stay with v3 even tho it keeps prompting me to go to v4.
I seem to be seeing the same thing on two separate boxes. When I'm doing nothing, memory use gradually increases. about:memory shows that it is specifically js/gc-heap that is increasing, and rather dramatically, say from 100 MB --> 900 MB overnight. This on Firefox 4.0.1 (Win32) though I may have seen it on Firefox 4.0 too. The problem seems new with Firefox 4.

Regrettably, the problem is difficult to track down even in a divide and conquer manner because I have so many add-ons and so tabs open in so many windows. It would help if memory use were tagged to a tab or a script but there isn't any such functionality in Firefox. One thing I noticed is that closing a tab caused the js/gc-heap memory to fall dramatically. This seems to be because garbage collection was triggered rather than due to specifically freeing the resource held by the tab because the tab closed was a text based Google result that I expect to require very little memory.

Maybe what I am seeing is related to Bug 619822.
(In reply to comment #6)

To eliminate one set of confounding factors I restarted Firefox in safe mode last night with the same session. Same thing. The first thing I did in Firefox this morning was to refresh the about:memory page and it shows that js/gc-heap memory use is up ~650 MB in 16 hours. After finishing the last sentence, I refreshed the about:memory page again and observed that gs/hc-heap had fallen to ~61 MB, suggesting garbage collection has occurred.
(In reply to comment #7)

The last couple of Mondays I've found Firefox has crashed when I get into the office. I now suspect this crash is due to a malloc() error after Firefox reaches the 2 GB per process limit, the result of not garbage collecting.
I observe similar behavior since FF4.0 (still in FF4.0.1 / FF5Beta3).
 when using thee Javascript functions setInterval, xmlHttpRequest and / or DOMParser. 
As long as Firefox is used(interactivly), memory allocation and release  or memory usage is linear. There's no growing memory consumption

But as soon as I don't interact anymore with Firefox for some time, after about a minute only some of the memory will be released each cycle. So the memory consumption grows over time. 
As soon as I interact again with Firefox (open / close a new Tab .. refresh any page), the memory usage falls back to normal (before the  inactivity) and allocation and release of the memory is cyclic as before: All that's allocated will be freed.
qisheng.zhao: I opened up bug 666101 which covers your original complaint.  

Chris and Matthew Kidd: your reports aren't detailed enough to help track down problems, as they don't have precise steps to reproduce.  You might like to try Firefox 5 (newly released) which fixes various leaks in Firefox 4.  Even better, you could try a nightly build (from nightly.mozilla.org) which fixes even more.  If you still have problems, feel free to file a new report, but please give more specific steps to reproduce, eg. a specific website(s) that demonstrate the problem.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
I switched to FF 5.0 yesterday, and I'm experiencing the same sort of leak on Fedora 15. If I leave FF overnight, RSS (physical RAM) usage grows from ~300MB
to 1.4GB (on a 3GB x86-32 system). I have a fair number of add-ons, so obviously one of them may be the problem - I'll try to do some safe mode testing when my real job permits.
(In reply to comment #11)
> I switched to FF 5.0 yesterday, and I'm experiencing the same sort of leak
> on Fedora 15. If I leave FF overnight, RSS (physical RAM) usage grows from
> ~300MB
> to 1.4GB (on a 3GB x86-32 system). I have a fair number of add-ons, so
> obviously one of them may be the problem - I'll try to do some safe mode
> testing when my real job permits.

In the time since I wrote comment 10, it's become clear that bug 656120, which was not fixed in FF5 but has been fixed in Nightly builds, has fixed a *lot* of "memory usage keeps growing overnight" problems.  Hopefully it'll fix your problem too, even with the add-ons present.

If it does, and if you have time, please feel free to add a comment to bug 656120 with some before and after measurements -- we're currently discussing whether to back-port the fix into FF6, so extra evidence about its effect would be helpful.  Thanks!
(In reply to comment #12)
> 
> If it does, and if you have time, please feel free to add a comment to bug
> 656120 with some before and after measurements -- we're currently discussing
> whether to back-port the fix into FF6, so extra evidence about its effect
> would be helpful.  Thanks!

Oh, and if you are willing to list the websites you have open and the add-ons you have installed, that's always very helpful.
You need to log in before you can comment on or make changes to this bug.