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.