0

I've seen these prior questions

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.

screenshot of System Monitor display PID, name, and the various memory columns for the systemd process


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?

NullVoxPopuli
  • 279
  • 2
  • 5
  • 16

0 Answers0