3 ms·
If you have a recent firefox you may be incorrect about your ram usage as firefox is no longer a single process. Here is how it looks on my system. fi
by michaelmrose 7y ago
If you have a recent firefox you may be incorrect about your ram usage as firefox is no longer a single process.
Here is how it looks on my system.
firefox-bin─┬─GPU Process───35*[{GPU Process}]
├─Privileged Cont───27*[{Privileged Cont}]
├─RDD Process───5*[{RDD Process}]
├─Socket Process───5*[{Socket Process}]
├─Web Content───28*[{Web Content}]
├─2*[Web Content───27*[{Web Content}]]
├─Web Content───33*[{Web Content}]
├─Web Content───22*[{Web Content}]
├─Web Content───30*[{Web Content}]
├─Web Content───32*[{Web Content}]
├─WebExtensions───27*[{WebExtensions}]
├─firefox-bin
└─97*[{firefox-bin}]
Here is a bit of bash to turn a number of bytes into a human readable label shamelessly stolen from somewhere saved as human
#!/bin/bash
b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,P,E,Z,Y}iB)
while ((b > 1024)); do
d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))"
b=$((b / 1024))
let s++
done
echo "$b$d ${S[$s]}"
Here is the best formulation of finding the memory usage of foo where foo can be a regular expression
echo 1024\*(pgrep foo| xargs pmap -x|grep total|awk '{print $5}'| paste -sd+ -)|bc|xargs human
In fish the meminfo function with custom functions not herein included
function meminfo
pgrep $argv| each pmap -x|g total|nth 5|sumof|multiplyby 1024|each human
end
Most of firefox's mememory is in firefox, Web Content, and WebExtensions
meminfo firefox returns only 250MB right now but meminfo 'firefox|Web' returns 1.5GB
If you are looking at just firefox you are definitely not getting the whole picture.
- dmos62 7y agoI got an unexpected result: For context pgrep --full /usr/lib/firefox/firefox | wc -l returns 10, while pgrep 'firefox|Web' | wc -l returns 9. Your posted command formatted and a missing $ added (I'm using bash): echo 1024\*\ $(\ pgrep --full /usr/lib/firefox/firefox \ | xargs pmap -x \ | grep total \ | awk '{print $5}'\ | paste -sd+ - \ )\ | bc \ | xargs ./human returned 220.63 MiB. Here's my htop excerpt: 3532M 286M 97512 S 0.0 9.6 9:20.59 │ └─ /usr/lib/firefox/firefox 2325M 74708 56596 S 0.0 2.4 0:00.42 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 41 2509M 121M 85300 S 0.0 4.1 0:15.84 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 40 2489M 173M 103M S 0.0 5.8 0:18.64 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 39 2389M 74172 57060 S 0.0 2.4 0:13.49 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 23 2540M 112M 89996 S 0.0 3.8 0:50.95 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 22 2513M 72396 58300 S 0.0 2.4 0:14.88 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 17 2413M 46488 34892 S 0.0 1.5 0:18.37 │ ├─ /usr/lib/firefox/firefox -contentproc -childID 16 250M 2132 1916 S 0.0 0.1 0:00.13 │ ├─ /usr/lib/firefox/firefox -contentproc -parentBuil 26.4G 85844 35008 S 0.0 2.8 0:57.39 │ └─ /usr/lib/firefox/firefox -contentproc -childID 3 Not sure what to make of it.
- michaelmrose 7y agoTo capture the other processes pgrep 'firefox|Web' to capture WebExtensions and Web Content
- dmos62 7y agoThat's what I'm talking about in the beginning of the post. 'firefox|Web' captures 1 one less process than `--full /usr/lib/firefox/firefox`. That one process is 0.1mb in my case.
- michaelmrose 7y agoI didn't know about --full you are correct