On 7 Jul 2021 20:32 +0200, from rtomek(a)ceti.pl (Tomasz Rola):
An excerpt from my ps:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
xxxon 12331 12.5 20.4 5898360 2519640 ? TNsl Mar29 18278:11 firefox-esr
I'm going to stick my neck out here by saying that the VSZ and RSS
values reported by ps, at least for Firefox, are largely meaningless.
I started my usual Firefox instance, which has a handful of plugins,
about a metric gazillion bookmarks, and has been my main web browser
profile for years (so it probably has collected some crud over time).
`ps auxw` reported that process as having a total RSS of a whopping
374 GB.
It is downright _impossible_ that Firefox could actually be using that
amount of volatile memory, because my system has "only" 32 GB RAM + 64
GB swap. The root file system, which on my system also holds the likes
of /usr/{bin,lib}, totals 29701 MB used according to `df -m`, plus ~
totals 22550 MB, so even if Firefox read _all_ of that into memory it
still wouldn't be anywhere _close_ to the reported RSS value, falling
short by about a factor 7x (and Firefox has no reason to even look at
much of what's there, like the 2.5 GB in /usr/share/games/flightgear).
While that Firefox instance was running, I ran `free -m`, which
reported 250 MB swap used (65285 MB free) and 26008 MB "memory
available". Very soon after closing Firefox (and soon enough to try to
ensure that nothing else major changed), I ran `free -m` again, which
then reported the same 250 MB swap used and a slightly larger 26298 MB
memory available; a difference of 290 MB between when Firefox was
running and when it was not.
That's a _factor almost 2300x_ difference between the reported RSS,
and the amount of memory that was actually freed up by closing the
browser.
The same experiment done with a brand-new browser profile gave a total
RSS of 751 GB for Firefox's processes combined, while free reports a
difference of 321 MB between running and not-running. That's within
striking distance of a factor 2400x difference.
Does this mean that software bloat isn't an issue? I would argue that
it does not. Does it mean that Firefox can't have, say, memory leaks,
causing it to over time have more memory allocated than it actually
uses? It does not; and in fact I believe that's something that has
been worked on over the years. But I think it's worth trying to be
honest about all this, and at least _try_ to not compare apples to
stars just because both resemble oblate spheroids and exert
gravitational influence. On modern systems, with everything from
shared libraries to memory-mapped I/O to routine use of memory
overcommitting, the resident set size is clearly a poor indicator of
the actual amount of memory actively used by a complex process.
--
Michael Kjörling •
https://michael.kjorling.se • michael(a)kjorling.se
“Remember when, on the Internet, nobody cared that you were a dog?”