I've found many posts on this website detailing how to find the usage of processes in linux, but most of these return the percent memory/cpu usage per process. I need to know the exact usage per process, as the results for the processes I'm interested in are always rounded down to zero.
Memory usage in a modern operating system with virtual memory and shared libraries is hard to define. Some things complicating things: Some of the memory of a process might:
- not actually be in RAM, but be swapped out to disk
- not yet be allocated, and only be allocated on first use
- be shared with other processes
- be a file on disk that is cached for efficiency reasons.
- not be system memory, but memory of e.g. a network card.
Depending on whether you want to include/exclude the parts of the list above, you get different results:
- RSS (Resident Set Size) in the amount of memory that that are actually in RAM for a process. This includes shared libraries, but excludes swapped out data.
- VSZ (Virtual Size) is the total amount of memory, including the part that is swapped out.
Also see this quention: https://stackoverflow.com/questions/7880784/what-is-rss-and-vsz-in-linux-memory-management