[oi-dev] Memory use with Firefox
Matthew R. Trower
dev at blackshard.net
Thu Jan 11 11:17:37 UTC 2024
On 1/4/24 10:54, gary_mills at fastmail.fm (Gary Mills) wrote:
> 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
> How much memory does firefox want?
All of it. Your surrender is foregone and non-negotiable.
Seriously, though, I imagine it's going to be related to the kinds of
sites you visit, what kind of assets they're sucking down, what kind of
monster javascript frontends they want to run clientside, etc...
Firefox basically has Operating System status these days. I've seen
individual tabs run anywhere from 32MB to 500MB+ each.
> 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
Just like with an OS, you need a process manager to answer these
questions. Unfortunately, you said that yours (about:process) wasn't
working --- did you ever figure that out? What if you start Firefox
from the shell; do you get any debug output when you try to load that
page? If you can get it working, it will give you a breakdown of each
process, including purpose, memory, and cpu usage. It's basically top.
Firefox is just not going to be slim though, no matter what you do; here
is mine with two (2!) tabs --- and one of them is about:process!
mtrower at saturn:~$ prstat -p $(pgrep firefox|tr '\n' ','),1306
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
20545 mtrower 1519M 611M sleep 29 0 0:07:39 0.2% firefox/133
1306 root 181M 49M sleep 43 0 0:10:39 0.2% Xorg/1
20551 mtrower 17G 184M sleep 59 0 0:00:38 0.0% firefox/27
23507 mtrower 311M 63M sleep 59 0 0:00:00 0.0% firefox/12
20552 mtrower 226M 37M sleep 59 0 0:00:00 0.0% firefox/3
20549 mtrower 227M 37M sleep 59 0 0:00:00 0.0% firefox/4
22729 mtrower 403M 158M sleep 59 0 0:00:05 0.0% firefox/27
23506 mtrower 311M 63M sleep 59 0 0:00:01 0.0% firefox/12
20550 mtrower 358M 104M sleep 59 0 0:00:06 0.0% firefox/28
23505 mtrower 310M 63M sleep 59 0 0:00:00 0.0% firefox/12
Total: 10 processes, 259 lwps, load averages: 0.62, 0.91, 0.86
about:processes reports:
Firefox [601MB]
github.com [158MB]
Tab: <the github repo I have open>
Extensions [184MB]
About pages [105MB]
Preloaded New Tab
Utility [37MB]
JavaScript Oracle
Network [37MB]
Preallocated [63MB]
Preallocated [63MB]
Preallocated [63MB]
...and you can see how those line up with prstat reporting.
What's up with your Xorg, though? 2.5GB? Your display server is nearly
as fat as your Firefox :O
-- Matthew R. Trower
More information about the oi-dev
mailing list