What's "Web Content" in "top" doing taking up memory?
Here's top
sorted by memory
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4927 shadi 20 0 2227492 320544 127896 S 0.7 8.2 0:42.40 firefox
4984 shadi 20 0 2071260 218544 100976 S 0.3 5.6 0:27.41 Web Content
ATM, I only have 1 firefox tab open, from which I'm submitting this question.
There's 4GB RAM in my laptop, so that's 200 MB for 1 tab for Web Content
.
If I close firefox, Web Content
goes away (and I have to retype this question .. lol),
so I guess it's related to firefox.
What's Web Content
?
https://ubuntuforums.org/showthread.php?t=2352693
Web content is a separate process created for a tab so that it is separated from the main process. This might be done to increase security and speed. If you kill that process, it'll also kill a tab so I wouldn't mess with it. Most websites nowadays use tons of memory because they assume that all modern computers have tons of spare memory.
If you'd like to see what parent process is responsible for the offending spun-off subprocess, you can run ps -ef | grep <PID>
, where "PID" is the offender's PID as revealed by top
. For instance, in my case right now I I can determine that Web Process is firefox's fault by doing this:
jeff@jbb-dell:~$ top
top - 19:21:13 up 3 days, 21:45, 1 user, load average: 0,53, 0,59, 0,52
Tasks: 354 total, 1 running, 353 sleeping, 0 stopped, 0 zombie
%Cpu(s): 7,9 us, 3,2 sy, 0,0 ni, 88,9 id, 0,0 wa, 0,0 hi, 0,0 si, 0,0 st
MiB Mem : 15838,9 total, 4047,6 free, 5705,6 used, 6085,7 buff/cache
MiB Swap: 8192,0 total, 8190,8 free, 1,2 used. 8589,9 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
192311 jeff 20 0 10,7g 379060 118544 S 37,5 2,3 1:06.22 Web Content
1 root 20 0 171828 9860 6684 S 0,0 0,1 0:03.77 systemd
2 root 20 0 0 0 0 S 0,0 0,0 0:00.05 kthreadd
jeff@jbb-dell:~$ ps -ef | grep 192311
jeff 192311 192141 29 19:17 ? 00:00:08 /nix/store/3j2ls1pg6ap5v04d356qxkf6fmykm6zh-firefox-95.0/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5414 -prefMapSize 240917 -jsInitLen 279148 -parentBuildID 20211209203124 -appDir /nix/store/3j2ls1pg6ap5v04d356qxkf6fmykm6zh-firefox-95.0/lib/firefox/browser 192141 tab
(I inserted a few extra newlines for readability.)