I've seen these prior questions
- Why does memory usage shown in System Monitor differ from that in ps_mem?
- System Monitor and free don't say the same
but, they seem to only be answering "why they're different", rather than how they're calculated.
I've been reading https://man7.org/linux/man-pages/man5/proc.5.html and am not sure the "real memory" is captured anywhere, because all the memory sharing that processes do make it .. maybe impossible to determine a single processes impact to RAM consumption? (or maybe there is a way, but it's complicated?)
So, Gnome/Ubuntu's System Monitor tool has an extra Memory column, in addition to Virtual Memory, Resident Memory, and Shared Memory.
So, if I wanted to calculate Memory myself from reading /proc (or something else), how would I do it?
Update
looks like,
Memory = (Resident Memory - Shared Memory)
Where, reading from /proc/{pid}/statm
PageSize = 4096
Memory = (RSS * PageSize) - (Shared * PageSize)
?
Seems... too easy?
