Why is Firefox using so much memory and how do I fix it?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
PerpetualNewb
Level 1
Level 1
Posts: 22
Joined: Wed Mar 08, 2023 12:15 pm

Why is Firefox using so much memory and how do I fix it?

Post by PerpetualNewb »

Back when I was using Windows 10, I could have had upwards of 200 tabs open in Firefox at any given moment. Now I max out my RAM without even reaching 100. I've no idea why, but would like to put a lid on this so I can go back to browsing the internet in peace. Here's my system info:

Code: Select all

System:
  Kernel: 5.15.0-69-generic x86_64 bits: 64 compiler: gcc v: 11.3.0 Desktop: Cinnamon 5.6.8
    tk: GTK 3.24.33 wm: muffin dm: LightDM Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: LENOVO product: 82L5 v: IdeaPad 5 Pro 16ACH6 serial: <superuser required>
    Chassis: type: 10 v: IdeaPad 5 Pro 16ACH6 serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40697 WIN serial: <superuser required> UEFI: LENOVO
    v: GSCN19WW date: 04/07/2021
Battery:
  ID-1: BAT0 charge: 53.8 Wh (79.8%) condition: 67.4/75.0 Wh (89.8%) volts: 16.2 min: 15.4
    model: Celxpert L20C4PE1 serial: <filter> status: Discharging
CPU:
  Info: 8-core model: AMD Ryzen 7 5800H with Radeon Graphics bits: 64 type: MT MCP arch: Zen 3
    rev: 0 cache: L1: 512 KiB L2: 4 MiB L3: 16 MiB
  Speed (MHz): avg: 3504 high: 4251 min/max: 1200/3200 boost: enabled cores: 1: 3389 2: 3394
    3: 3392 4: 3474 5: 3381 6: 3386 7: 3402 8: 3393 9: 3393 10: 3371 11: 3391 12: 3429 13: 3393
    14: 3392 15: 4251 16: 4248 bogomips: 102200
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
  Device-1: AMD Cezanne vendor: Lenovo driver: amdgpu v: kernel pcie: speed: 8 GT/s lanes: 16
    ports: active: eDP-1 empty: DP-1,HDMI-A-1 bus-ID: 05:00.0 chip-ID: 1002:1638
  Device-2: Chicony Integrated Camera type: USB driver: uvcvideo bus-ID: 3-4:3
    chip-ID: 04f2:b6be
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: amdgpu,ati
    unloaded: fbdev,modesetting,vesa gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 2560x1600 s-dpi: 96
  Monitor-1: eDP res: 2560x1600 dpi: 188 diag: 407mm (16")
  OpenGL: renderer: RENOIR (renoir LLVM 15.0.6 DRM 3.42 5.15.0-69-generic) v: 4.6 Mesa 22.2.5
    direct render: Yes
Audio:
  Device-1: AMD Renoir Radeon High Definition Audio vendor: Lenovo driver: snd_hda_intel v: kernel
    pcie: speed: 8 GT/s lanes: 16 bus-ID: 05:00.1 chip-ID: 1002:1637
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor vendor: Lenovo driver: N/A pcie:
    speed: 8 GT/s lanes: 16 bus-ID: 05:00.5 chip-ID: 1022:15e2
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel v: kernel pcie:
    speed: 8 GT/s lanes: 16 bus-ID: 05:00.6 chip-ID: 1022:15e3
  Sound Server-1: ALSA v: k5.15.0-69-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter vendor: Lenovo
    driver: rtw89_pci v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: 2000 bus-ID: 03:00.0
    chip-ID: 10ec:8852
  IF: wlo1 state: up mac: <filter>
  IF-ID-1: ipv6leakintrf0 state: unknown speed: N/A duplex: N/A mac: <filter>
  IF-ID-2: proton0 state: unknown speed: 10 Mbps duplex: full mac: N/A
  IF-ID-3: pvpnksintrf0 state: unknown speed: N/A duplex: N/A mac: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8 bus-ID: 3-3:2
    chip-ID: 0bda:4852
  Report: hciconfig ID: hci0 rfk-id: 43 state: up address: <filter> bt-v: 3.0 lmp-v: 5.2
    sub-v: 6d7a
Drives:
  Local Storage: total: 953.87 GiB used: 301.25 GiB (31.6%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB1T0HBLR-000L2 size: 953.87 GiB speed: 31.6 Gb/s
    lanes: 4 serial: <filter> temp: 36.9 C
Partition:
  ID-1: / size: 937.33 GiB used: 150.62 GiB (16.1%) fs: ext4 dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/nvme0n1p1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 1.36 GiB (67.9%) priority: -2 file: /swapfile
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002
  Hub-2: 2-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s chip-ID: 1d6b:0003
  Hub-3: 3-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002
  Device-1: 3-3:2 info: Realtek Bluetooth Radio type: Bluetooth driver: btusb rev: 1.0
    speed: 12 Mb/s chip-ID: 0bda:4852
  Device-2: 3-4:3 info: Chicony Integrated Camera type: Video driver: uvcvideo rev: 2.0
    speed: 480 Mb/s chip-ID: 04f2:b6be
  Hub-4: 4-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s chip-ID: 1d6b:0003
Sensors:
  System Temperatures: cpu: 20.0 C mobo: N/A gpu: amdgpu temp: 45.0 C
  Fan Speeds (RPM): N/A
Repos:
  Packages: apt: 2324
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
    1: deb [arch=amd64] https: //dl.google.com/linux/chrome/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http: //packages.linuxmint.com vera main upstream import backport
    2: deb http: //archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    3: deb http: //archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    4: deb http: //archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
  Active apt repos in: /etc/apt/sources.list.d/protonvpn-stable.list
    1: deb [arch="all", signed-by=/usr/share/keyrings/protonvpn-stable-archive-keyring.gpg] https: //repo.protonvpn.com/debian stable main
Info:
  Processes: 395 Uptime: 2d 22h 58m Memory: 13.52 GiB used: 10.53 GiB (77.8%) Init: systemd v: 249
  runlevel: 5 Compilers: gcc: 11.3.0 alt: 11/12 Client: Unknown python3.10 client inxi: 3.3.13
Last edited by LockBot on Sat Sep 30, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Midnight True
Level 7
Level 7
Posts: 1549
Joined: Wed Jul 20, 2022 3:23 am
Location: Southern and Southwestern area of Mato
Contact:

Re: Why is Firefox using so much memory and how do I fix it?

Post by Midnight True »

i believe this is caused by your swap kicking off to preserve RAM for active processes. Swap is a reserve memory but based on your HDD or SSD thus is naturally slower but a linux feature to prevent total freeze of your system during heavy system loading.
You can check how much swap your system is using during your said work flow through this terminal command:

Code: Select all

free -m
I recommend to consider adjusting your workflow by using this add-on https://addons.mozilla.org/en-US/firefox/addon/onetab/ to better manage your opened tabs. For more info check this out https://easylinuxtipsproject.blogspot.c ... html#ID1.1

Edit Note: Rectified typos
Last edited by Midnight True on Fri Mar 31, 2023 1:53 am, edited 2 times in total.
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

Re: Why is Firefox using so much memory and how do I fix it?

Post by zcot »

I open 3 random web pages and checked the memory footprint, one was this site(the small one).

5.64+18.36+42.35 = 66.35 MB

average it: /3 = 22.12 MB per page.

with 200 tabs: * 200 = 4.32 GB

But that's only the page itself. That's static load the page, 200 of them. That's not interaction, that's not browsing a site. Now what about the infrastructure to even handle the pages for Firefox? and what about beyond that? caching? pages are using ajax or something, there's all this interactive activity, hardly anything is just a static page anymore, all the ads transfer info? I don't have an easy metric on that, but it counts in a big way. So exponentially multiply the numbers.

I check right now in Firefox: about:memory and I have 934.72 MB load and I have maybe 20 tabs I've been playing with searching different things for IRC. A bunch of Ubuntu tech sites, termbin.com pages, image dumps, man pages, I have email, and I was looking at something on amazon .com.

You just can't expect, -there's such a huge amount of ad revenue interaction right now on the internet there's no way you can get away from the fact that any various page requirement is a big deal!

You say 200 pages, but the real fact is that you are not dealing with all 200 or anywhere near that in any reasonable amount of real-time activity, so there's your solution. And that's the source of the problem too.

Just close the browser now-and-then, and reload it, and you can pull up the settings -> history -> reload session. That deactivates all the tabs, and they will activate when you need to interact with them again.
billyswong
Level 8
Level 8
Posts: 2235
Joined: Wed Aug 14, 2019 1:02 am

Re: Why is Firefox using so much memory and how do I fix it?

Post by billyswong »

Some websites are memory leaking. After I identify them through about:memory, I tell uBlock Origin to block out the problematic script files in those websites. Then memory consumption improves. Those advertisement companies are hogging everyone's computer resources, then complain why people are blocking them :roll:
rickNS
Level 9
Level 9
Posts: 2981
Joined: Tue Jan 25, 2011 11:59 pm

Re: Why is Firefox using so much memory and how do I fix it?

Post by rickNS »

billyswong wrote: Fri Mar 31, 2023 1:52 am Some websites are memory leaking. /CUT/
Those advertisement companies are hogging everyone's computer resources, then complain why people are blocking them :roll:
Just like those companies who spam you email sending "offers" on a daily basis.
The web is near unusable without blocking some of the crap.
And yes some websites are far worse than others.

Just 3 facebook tabs will about kill a Virtual Machine with Mint 21, and 2 GB Ram. (I'm NOT a facebook user, and only ever "looked in" with a virtual machine) Which is why I said in a recent thread that Mint 21 needs more than 2 GB for satisfactory use, yes sure you can open some sites like this one without trouble, but this site is an exception with only one ad.

In any case I find it difficult to see a need for 100 tabs, perhaps there is a reason I haven't thought about ? I typically use what most consider quite a few tabs, usually 10 to 20, but once you go past a certain number each one is so small you can't see what is on it, so what's the point ?
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Why is Firefox using so much memory and how do I fix it?

Post by Cosmo. »

PerpetualNewb wrote: Thu Mar 30, 2023 7:53 pm Back when I was using Windows 10, I could have had upwards of 200 tabs open in Firefox at any given moment. Now I max out my RAM without even reaching 100
How do you measure that? How did you measure this in Windows? And not to forget: How do you count 200 tabs? If I have 200 lines in LO Calc, I can read the numbers of the rows on the left edge, but which indicator do you use for counting Tabs?
Petermint
Level 9
Level 9
Posts: 2983
Joined: Tue Feb 16, 2016 3:12 am

Re: Why is Firefox using so much memory and how do I fix it?

Post by Petermint »

The default configuration could be different in each. There are things you can change. You would need to compare the settings file between Windows and Linux.

From years of experience with both OSs on the desktop and servers, Windows tends to progressively push things into the page file, creating a gradual slow down most people do not notice across the day although some might reboot at lunch time. Linux tends to leave paging until the last minute then panic, creating a noticeable limit.

If Windows worked the same as Linux, the billion people using Windows at work would notice and demand double the memory or reboot a few times each day. The world would no longer slow down every day, saving a million person years as a result.
User avatar
NoHo Hank
Level 5
Level 5
Posts: 564
Joined: Wed Jun 29, 2022 6:03 am

Re: Why is Firefox using so much memory and how do I fix it?

Post by NoHo Hank »

install uBlock Origin. Here is explained how to.
https://privacy-handbuch.de/handbuch_21d2.htm
And how to update the ad blocking filter list. More then 100.000 filters!
I'm never bothered by adds. And my memory neither.
Demand technology that serves us - https://peoplevsbig.tech/
None of Your Business https://noyb.eu/en
PerpetualNewb
Level 1
Level 1
Posts: 22
Joined: Wed Mar 08, 2023 12:15 pm

Re: Why is Firefox using so much memory and how do I fix it?

Post by PerpetualNewb »

Sorry for not responding sooner; things have been a bit hectic around here lately. I already have uBlock Origin installed and on medium mode. Frankly, I think it might just be time for me to switch out my browser, especially with Mozilla going downhill and arkenfox due to be deprecated. I recently heard Mullvad was collaborating with the Tor project to make a pretty decent Firefox fork. I already made a post a while ago asking about different browsers but I omitted this one, so I think I'll make a new post asking about it.
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

Re: Why is Firefox using so much memory and how do I fix it?

Post by zcot »

did you browse into that at all from the other day? Firefox uses all the memory and mint hangs viewtopic.php?t=393677
Locked

Return to “Beginner Questions”