Firefox doesn't release memory after closing tabs
Categories
(Core :: General, defect)
Tracking
()
People
(Reporter: jeremy9856, Unassigned)
Details
(Keywords: memory-footprint, Whiteboard: [MemShrink:P3])
Attachments
(6 files)
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0 Build ID: 20170420084331 Steps to reproduce: Hello, Firefox doesn't release memory after closing some tabs. The Web Content process release the memory only when you open an empty tab and close all the other one. I tried in safe mode but it's the same. I'm on Fedora 25, Firefox 53. Here is my user.js user_pref("layers.acceleration.force-enabled", true); user_pref("browser.tabs.remote.autostart", true); user_pref("browser.tabs.remote.force-enable", true); user_pref("extensions.pocket.enabled", false); user_pref("privacy.trackingprotection.enabled", true); user_pref("browser.safebrowsing.enabled", false); user_pref("browser.safebrowsing.malware.enabled", false); user_pref("dom.event.clipboardevents.enabled", true); user_pref("browser.tabs.loadBookmarksInBackground", true); user_pref("reader.parse-on-load.enabled", false); user_pref("plugins.navigator_hide_disabled_flash", true); Thanks !
Reporter | ||
Comment 1•7 years ago
|
||
memory not released
Reporter | ||
Comment 2•7 years ago
|
||
memory released
Updated•7 years ago
|
Reporter | ||
Comment 3•7 years ago
|
||
It's quite important because you run out of memory (4Gb) after a day of work and need to close all tabs (or Firefox).
Reporter | ||
Updated•7 years ago
|
Comment 4•7 years ago
|
||
jeremy9856: Please do not fiddle with the Priority value when you are not involved in doing the actual work. Thanks.
Comment 5•7 years ago
|
||
It's really not clear this bug is anything to do with the tabbrowser itself, moving back for triage.
Hello, I was able to reproduce this release memory issue with 20170522030207 build, running on Windows 10 Pro, x64.
Steps to reproduce: 1. Launch mozilla nightly build. 2. Make sure that you have at least three tabs opened (used in test: http://cnn.com, http://www.eurosport.com/, http://www.bbc.com). 3. Open Task Manager. 4. Observe memory usage when closing first tab and second one. Expected results: Release memory is reflected in Task Manager. Actual results: Memory usage keeps increasing before is stabilized.
Maybe someone with more experience regarding the process of memory cleaning could provide more feedback for this issue. Kind regards, Alin
Reporter | ||
Updated•7 years ago
|
Comment 9•7 years ago
|
||
Moving to Core::Untriaged -- I suspect this needs further investigation before pinning it as a problem specific to the memory allocator?
Comment 10•7 years ago
|
||
(In reply to jeremy9856 from comment #0) > User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 > Firefox/53.0 > Build ID: 20170420084331 > > Steps to reproduce: > > Hello, > > Firefox doesn't release memory after closing some tabs. The Web Content > process release the memory only when you open an empty tab and close all the > other one. I tried in safe mode but it's the same. This is expected behavior, the web content process will stay open with e10s enabled. The only way to force close it is with the method you noted. Please note that in newer versions we have "e10s-multi" which means you can have up to 4 web content processes. If you have for tabs open I would expect for web content processes, if you close 3 of those I would expect 1-2 web content processes to remain. So to clarify, is the problem that when you closed a few tabs memory didn't go down? The best way to measure that is to take a memory report with the tabs open, close the tabs, *wait a few minutes*, measure again. I'd expect the memory to go down, if it does not you can try the 'minimize memory usage' button in about:memory and measure again. If the results are not satisfactory can you upload those memory reports? Another note: from your memory report it looks like a fair amount is allocated for images: > 642.28 MB (100.0%) -- explicit > ├──487.16 MB (75.85%) -- images > │ ├──486.58 MB (75.76%) -- content > │ │ ├──485.39 MB (75.57%) -- raster/used > │ │ │ ├──267.54 MB (41.65%) -- image(1302x802, <anonymized-1>) > │ │ │ │ ├──260.33 MB (40.53%) -- locked > │ │ │ │ │ ├──256.34 MB (39.91%) ── surface(1302x802 (animation))/decoded-heap > │ │ │ │ │ └────3.98 MB (00.62%) ── surface(1302x802, compositing frame)/decoded-heap > │ │ │ │ └────7.21 MB (01.12%) ── source > │ │ │ ├──189.64 MB (29.53%) -- image(2640x1408, <anonymized-6>) > │ │ │ │ ├──186.80 MB (29.08%) -- locked > │ │ │ │ │ ├──172.62 MB (26.88%) ── surface(2640x1408 (animation))/decoded-heap > │ │ │ │ │ └───14.18 MB (02.21%) ── surface(2640x1408, compositing frame)/decoded-heap > │ │ │ │ └────2.84 MB (00.44%) ── source > │ │ │ ├───24.26 MB (03.78%) -- image(582x256, <anonymized-14>) > │ │ │ │ ├──22.13 MB (03.45%) -- locked > │ │ │ │ │ ├──21.56 MB (03.36%) ── surface(582x256 (animation))/decoded-heap > │ │ │ │ │ └───0.57 MB (00.09%) ── surface(582x256, compositing frame)/decoded-heap > │ │ │ │ └───2.13 MB (00.33%) ── source > │ │ │ └────3.96 MB (00.62%) ++ (12 tiny) > │ │ └────1.19 MB (00.19%) ++ vector/used > │ └────0.58 MB (00.09%) ++ (2 tiny) It's possible we have a leak there, but the odds are you're on a website that's rendering a few large images, which is also expected behavior.
Reporter | ||
Comment 11•7 years ago
|
||
(In reply to Eric Rahm [:erahm] (please no mozreview requests) from comment #10) > So to clarify, is the problem that when you closed a few tabs memory didn't > go down? Yes. When you close a tab the memory used by this tab should be freed. That not the case even after minutes or hours, because, like I said in comment 3, I run out of memory (4Gb) after a day of work and need to close all tabs (or Firefox) to get back my memory ! I will upload some memory reports when I will have the time but you should see it by yourself just by opening a lot a tabs and closing them except one. > Another note: from your memory report it looks like a fair amount is > allocated for images. > It's possible we have a leak there, but the odds are you're on a website > that's rendering a few large images, which is also expected behavior. I don't remember what site I browsed. I will make some tests if I have time.
Updated•7 years ago
|
Updated•7 years ago
|
Reporter | ||
Comment 12•7 years ago
|
||
Reporter | ||
Comment 13•7 years ago
|
||
Reporter | ||
Comment 14•7 years ago
|
||
Reporter | ||
Comment 15•7 years ago
|
||
Reporter | ||
Comment 16•7 years ago
|
||
Here is 4 logs. 1. I opened something like 20 tabs (without a lot of images, mostly archwiki) and made memory-report-before.json.gz 2. I closed most of the tabs (leave something like 4 opened) and made memory-report-just-after.json.gz 3. I waited 15mn without using Firefox and made memory-report-15mn-after.json.gz 4. I used a little bit Firefox for 1h without opening new tabs and made memory-report-1h-after.json.gz Hope it help :)
Comment 17•7 years ago
|
||
Comparing #1 with #3 the memory usage goes down after closing the tabs, I'm not sure what the issue is at this point. The amount would be larger but there's a fair amount in bin-unused; this is expected and is memory that will be reused when you open more tabs.
Reporter | ||
Comment 18•7 years ago
|
||
You are right, in #3 the memory goes down but not enough. In Gnome system monitor Firefox took about 350Mb and Web Content about 600Mb with all tabs opened. In #3 still in Gnome system monitor Firefox took about 350Mb and Web Content 400Mb with only 4 tabs remaining open. So I repeat, the problem is, after a day of use the unreleased memory pile up and Firefox consume far too much memory.
Updated•7 years ago
|
Comment 19•7 years ago
|
||
Moving from Core::Untriaged to Core::General https://bugzilla.mozilla.org/show_bug.cgi?id=1407598
Comment 20•4 years ago
|
||
Firefox doesn't release the memory back to the OS. This can lead to thrashing and useless writes to virtual memory. I have to restart firefox every once in a while. Some webapps can use Gigs of RAM, without releasing that memory back to the OS it means some time later unused memory will be written to disk which will cause unexpected jitter throughout the OS and increases potential for thrashing.
Comment 21•4 years ago
|
||
benzakhar: You need to provide proof and clear steps to reproduce for statements.
Comment 22•4 years ago
|
||
I'm sorry I bring no new information, these are the steps that also reproduce for me as mentioned above.
- Open htop to observe memory used by firefox
- Open a couple tabs that consumes memory
- close the tabs
- observe on htop that a significant amount of memory is still held by firefox
- restart firefox and notice that firefox has a way less memory footprint.
I didn't know about:memory. I'm going to try those buttons next time instead of restarting firefox. Sorry I brought no new information that the people above have given, just frustrated as recently I needing to restart firefox quite a bit.
Comment 23•2 years ago
|
||
Glad to help diagnose this bug, please let me know what data I can provide.
Issue still present in Firefox five years after initial bug was cut, has been persistent all these years with no discernible improvement across any of the 12+ devices I've used, multiple OS (Linux, MacOS, Windows).
An example from today on Ubuntu 20.04 with Firefox 100.0.2, 32 GB RAM. After closing dozens of tabs so I only have 6 tabs left open, Firefox memory usage stayed at ~12 GB as though I closed no tabs. Using the buttons in about:memory to initiate GC and such has only minor effect, decreasing memory usage to ~4 GB. As other posters mention, the only fix that reliably works is closing Firefox and reopening, at which point memory usage for the exact same 6 open tabs fell from ~11 GB to ~4 GB!
The site which most reliably triggers this issue for me is Amazon.
Comment 24•2 years ago
|
||
(In reply to holocronweaver from comment #23)
Woops, typo fixed below. Should have been 11 GB, not 4 GB.
Using the buttons in about:memory to initiate GC and such has only minor effect, decreasing memory usage to ~11 GB.
Updated•2 years ago
|
Comment 25•8 months ago
|
||
I confirm the same issue on 116 on Windows.
After some time of opening / closing several tabs, memory usage remains permanently elevated, even if I go back to the original tabs I had open.
Using "minimize energy usage" in about:memory does reduce memory usage a bit, but it never recovers to the level used by the original tabs.
It remains fairly high.
Description
•