[oi-dev] Memory use with Firefox

Gary Mills gary_mills at fastmail.fm
Thu Jan 4 16:54:36 UTC 2024


I have a system that I mostly use for web brousing.  It has an AMD
Ryzen 7 2700 Eight-Core Processor, and runs a recent version of OI,
from 2023-11-07.  It has 48 gigs of memory with an 8-gig swap
partition.  Using Firefox 119.0.1, I noticed that Firefox became
sluggish only a few days after boot.  I have five permanent tabs in
Firefox, along with several temporary tabs, using the "Open in new
tab" option.  I assumed that ZFS and firefox were fighting over
memory.  Indeed, the ZFS ARC was using 32 gigs of memory.  To fix this
problem, I put the following into a file in /etc/system.d and
rebooted:

    set zfs:zfs_arc_max = 0x2E0000000

This change limited the ARC to 12 gigs, and seems to have corrected
the problem.  Firefox scrolling was quick and smooth, and continued to
be so for the next two weeks.

After the reboot, the swap space looked like this:

    <mills at ryzen:2442>$ swap -sh
    total: 940.79M allocated + 536.90M reserved = 1.44G used, 44.81G available

After 14 days, it was like this:

    <mills at ryzen:2761>$ swap -sh
    total: 4.98G allocated + 2.00G reserved = 6.98G used, 25.91G available

The free memory seems to have stabilized at about 26 gigs.  I assume
that ZFS allocates memory from this free space.

I still have questions about the memory usage of firefox.  Here's how
memory size looked after 14 days:

    <mills at ryzen:2762>$ prstat -c -s size
    Please wait...
       PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
      1598 mills    2850M 1481M sleep   49    0  26:56:22 0.7% firefox/198
       941 mills    2558M 2532M sleep   59    0  27:14:03 0.2% Xorg/3
      1978 mills     578M  272M sleep   59    0   0:03:10 0.0% firefox/25
     18154 mills     569M  261M sleep   44    0   0:15:33 0.1% firefox/26
      1868 mills     558M  254M sleep   59    0   0:14:22 0.0% firefox/28
      1867 mills     414M  158M sleep   59    0   0:10:04 0.0% firefox/24
      1601 mills     411M  151M sleep   59    0   0:01:01 0.0% firefox/24
      1602 mills     384M  147M sleep   59    0   0:00:32 0.0% firefox/24
      1866 mills     360M  124M sleep   59    0   0:09:19 0.0% firefox/24
     18878 mills     340M  108M sleep   49    0   0:00:01 0.0% firefox/25
     19646 mills     310M   68M sleep   49    0   0:00:00 0.0% firefox/12
     19639 mills     310M   69M sleep   59    0   0:00:00 0.0% firefox/12
     19642 mills     310M   68M sleep   49    0   0:00:00 0.0% firefox/12
      1604 mills     227M   45M sleep   59    0   0:00:03 0.0% firefox/3
      1600 mills     227M   44M sleep   59    0   0:00:00 0.0% firefox/4
    Total: 133 processes, 1323 lwps, load averages: 0.22, 0.23, 0.21

Why are there so many firefox processes?  I was expecting one process
per tab.  Clearly there are many more.  Why do some of the processes
have so many threads?  How much memory does firefox want?


-- 
-Gary Mills-		-refurb-		-Winnipeg, Manitoba, Canada-



More information about the oi-dev mailing list