Each process requires memory for the execution. But with a virtual memory operating system like Linux the answer is quite complex. The numbers given by top and ps don’t really add up. You can see an individual process’ memory usage by examining /proc/<pid>/status

Details about memory usage are in

  • /proc/<pid>/statm
  • /proc/<pid>/maps
  • /proc/<pid>/smaps

The top command will show VSS and RSS (discussed below)


The two most common metrics for the memory usage of a process are the virtual set size (Vss) and the resident set size (Rss). You will see see these numbers in ps and top command output.

  • Vss is also called VIRT and VSZ. It is the total amount of virtual memory of the process has mapped, regardless of whether it has been committed to physical memory.
  • Rss, also called RES and RSS, is the amount of physical memory being mapped.
  • Uss is unique set size, which is the amount of memory that is private to the process and is not shared with any other.
  • Pss is the proportional set size, which is the amount of memory shared with other processes, divided by the number of processes sharing each page.

Rss is how much memory this process currently has in main memory (RAM). This includes memory allocated from shared libraries, given they are still present in memory. Also, it includes all heap and stack memory. RSS is not an accurate measure of the total memory processes are consuming, because it does not include memory consumed by libraries that were swapped out. On the other hand, the same shared libraries may be duplicated and counted in different processes.

Vss is how much virtual memory the process has in total. This includes all types of memory, both in RAM and swapped out.

If you need to get a more detailed idea about the memory footprint of a process, you have some options. You can go through /proc/$PID/map and weed out the stuff you don’t like. If it’s shared libraries, the calculation could get complex depending on your needs. Thankfully Pss gives an accurate measure of the memory a process is using, taking into account sharing between processes. The total amount of memory in use by all processes is the sum or their Pss.

The Uss is also useful because it shows the pages that are unique. You can think of it as the price you would pay in memory if you forked that process to create a copy. This is the amount of memory that would be freed if the application was terminated right now.

Pss is the amount of memory shared with other processes, accounted in a way that the amount is divided evenly between the processes that share it. This is memory that would not be released if the process was terminated, but is indicative of the amount that this process is “contributing”

Using PS

We can use ps to check both RSS and VSZ:

ps aux

Let’s break down our command to understand what every flag represents:

  • a – displays processes from all users
  • u – displays the specific user of each process
  • x – displays all processes not attached to a terminal, these include services such as crond or upowerd

From the above output, we can deduce that the RSS column represents the resident set size and the VSZ column represents the virtual memory size in kilobytes.

We can also use top to check both RSS and VSZ. One big advantage of using top is that it keeps checking for changes in the list of processes. This allows us to see changes to RSS and VSZ in real-time. The first part of the output shows a lot of useful information such as the total number of processes running, number of available users, and RAM and swap memory information. The second portion of the output displays all processes running and their respective values from the columns. The column VIRT, represents VSZ, while the column RES represents RSS.