Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using ps, I can see the size, the vsize (same as top's VIRT?), and the rss (same as top's RES?). (One more I see in top is SHR.)

Could someone summarize for me what these different fields mean?

share|improve this question
I'd rather see a nice summary on this page than a link that might disappear so that this page can live as a reference. –  Jim Hunziker Jul 31 '09 at 15:53
add comment

2 Answers

up vote 21 down vote accepted

In short:

  • Virtual size: is the amount of address space that a process is managing. The virtual address space contains everything that the process can access through pointers (memory address references). For example, if your program gets access to the framebuffer of your video card, that memory is mapped to the process virtual space and receives an address that is stored to a pointer. Memory-mapped files and anonymous mappings are also accounted into the virtual address space size. Pretty much everything is in the virtual size. If you sum up the size of all address ranges listed in /proc/<pid>/maps, it should return you roughly the same value of the virtual size.

  • Resident size: is the amount of memory that belongs specifically to that process that is currently resident in memory. That means, the amount of memory that is not in swap. Note that parts of the process can be in swap memory even when the process is running. The operating system will pull these regions from the swap when the process tries to access it. This should include the heap, the stacks of all threads and other private mappings. If you look in /proc/<pid>/maps, the [stack], [heap] and other anonymous mappings (those without file paths) are either swapped or accounted in the resident size.

  • Shared size: is the amount of memory that may belong to multiple processes. For example, if you have four instances of the same application loaded in memory, you will have four instances of the heap and at least four stacks, one for each process (this is the resident memory), but you will have only one instance of the binary code of the program and its libraries. This is the shared space. Not only it includes the program binary code and its libraries, but also localization files, read-only program data, SysV and POSIX shared memory segments, semaphores, etc... If you look in /proc/<pid>/maps, most mappings tied to library and program files are shared.

Note that RSS + SHR <= VIRT, always.

share|improve this answer
Incidentally, on recent versions of linux you can see a very detailed breakdown of memory usage in /proc/<pid>/smaps –  bdonlan Jul 31 '09 at 17:26
Shared size is memory that may be shared. If an application is sole user of library the library will be kept in memory by single process. This way even shared memory can be "process owned" memory. –  Hubert Kario Dec 31 '12 at 10:33
add comment

In Juliano answer:

Note that RSS + SHR <= VIRT, always.

This is just false. SHR contains all virtual memory that could be shared with other processes, and RSS contains all memory physically in RAM that is used by the process.

Thus all shared memory currently in RAM is counted both in SHR and in RSS, so SHR + RSS has no meaning since it can contain duplicates counts.

To construct a process with RSS + SHR > VIRT, just mmap a large file (1GB), then read it completely: the mmaped file will be loaded in RAM, and VIRT, SHR and RSS will each be slighly larger than 1GB, so SHR + RSS > VIRT.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.