Linux

Linux top; VIRT RES SHR

VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card’s RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.

RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column.) This will virtually always be less than the VIRT size, since most programs depend on the C library.

SHR indicates how much of the VIRT size is actually sharable (memory or libraries). In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.

When you are running top there are three fields related to memory usage. In order to assay your server memory requirements you have to understand their meaning.

The first thing you have to know is that all the columns (VIRT RES SHR) report memory usage in KB (kilobytes).

VIRT column (virtual memory size of the process) means how much memory a particular application has requested, also it counts swapped to the disk memory pages. But this field does NOT mean that this process actually uses that amount of memory, to use it for real this memory has to be initiated for example using memset. Generally speaking you can disregard this column.

RES column (resident set size, the non-swapped physical memory that a task has used (in kiloBytes)) is the most important one – it actually shows how much physical RAM is allocated for a process.

SHR column says how much memory a particular application is sharing with other applications. E.g., most applications in Linux depend on libc, and as every application links with it and uses its functions then this library memory space is mapped to all process simultaneously to conserve memory.

Consult with this pages for better understanding:

1. http://tldp.org/LDP/tlk/mm/memory.html
2. http://www.ibm.com/developerworks/linux/library/l-mem26/

3 Responses to “Linux top; VIRT RES SHR”

  1. insanergy.nl

    Insanergy.. Bully :)

  2. Benjamin

    Thank You. That really helped me with my server.

  3. Tram Muoi

    Thank you.

Leave a Reply


}) _0- O-) ;) ;( :{ :o :Y :X :P :N :D :@ :? :9~ :) :(