rmemusage tries to show the real memory usage used by processes/users on linux. It uses libproc to query process information and estimate _real_ per-process memory usage.
To build:
g++ main.cc -l procps -o rmemusage
Note: It appears that on some system you need to replace procps by proc in the previous command
To run (as root to have information about all processes):
# ./rmemusage [-u]
When ran without options, it simply output all processes currently running and their memory usage. When ran with the -u option, it calculate memory usage per-user.
Columns description:
PID: Process id (posix thread id)
PPID: Parent process
NAME: Process name
USER: User running that process
RSS: Resident Set Size, it's the process memory usage + memory used by all shared libs it uses
PSS: Proportional Set Size (process memory + fraction of shared memory with other processes)
SWAP: Part of the process memory that is swapped
REAL: PSS + SWAP