What Is in RAM?

Hi all,

htop lists a good 3.5 GB of RAM usage, but the system monitor only totals up to 300-400 MB (which seems reasonable since I had nothing but the gnome shell running).

How can I get a quick overview of RAM usage / what is using how much?

This is very frustrating for me. Yesterday I even had processes killed due to RAM limits and I have no idea where the bottleneck is.

Something like SnakeViz for RAM would come in handy.

Thanks a lot!

P.S. All tmpfs (df -t tmpfs | awk '/tmpfs/{sum+=$3} END {print sum}') occupy about 60 MB currently.

To fully understand how linux systems use memory is a complex matter.
You can get a basic view from the output of tools like top.

$ top -b -n 1
top - 21:44:48 up 1 day, 12:29,  2 users,  load average: 0.00, 0.01, 0.00
Tasks: 170 total,   1 running, 169 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  8.7 sy,  0.0 ni, 91.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3896.0 total,   1571.4 free,    720.1 used,   1898.6 buff/cache
MiB Swap:   3896.0 total,   3896.0 free,      0.0 used.   3175.9 avail Mem

Here you can see an entry for buff/cache that tells you about memory the kernel is using to optimise the systems performance.

If you look at the contents of /proc/meminfo you can see a lot more details.
And when if comes to processs memory details are on /proc/<PID>/smaps.

Gnome ships gnome-system-monitor, which will show you RAM allocation by process…

1 Like

[…] system monitor only totals up to 300-400 MB […]

You have to add kernel overhead and kernel caches to the memory used by processes.
Edit: and beware that processes share memory so just adding the memory of all processes will give you too big a answer.
Like I said memory use in a modern OS is complex.

Perhaps some is used by your zram swapfile?