Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

first of all:

  • I don't use stackadmin or similar so please don't vote for moving there,
  • I'm reading man top and paper "what every programmer should know about memory ..."
  • I need really simple explanation like for retard ;)

Having following top dump:

top - 11:21:19 up 37 days, 21:16,  4 users,  load average: 0.41, 0.75, 1.09
Tasks: 313 total,   5 running, 308 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.4%us,  0.6%sy,  0.9%ni, 96.2%id,  0.1%wa,  0.0%hi,  1.9%si,  0.0%st
Mem:  132103848k total, 131916948k used,   186900k free,    54000k buffers
Swap: 73400944k total, 73070884k used,   330060k free, 13931192k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3305 tudb      25  10  144m  52m  940 R  6.0  0.0   1306:09 app 
 3011 tudb      15   0 71528  19m  604 S  3.3  0.0 171:57.83 app 
 3373 tudb      25  10  209m  93m  940 S  3.0  0.1   1074:53 app 
 3338 tudb      25  10  144m  47m  940 R  2.7  0.0 780:48.48 app
 4227 tudb      25  10  208m  99m  904 S  1.3  0.1 198:56.01 app
 8506 tudb      25  10 80.7g  49g  932 S  2.0 39.6 458:31.22 app 

I'm wondering what is:

  • RES (my expl. physical memory consumption ? see 49GB)
  • VIRT (memory mapped disk to cache? see 80GB)
  • SHR (shared pages?)
  • Swap: (is this cached label - for memory mapped disk into swap cache?)
  • Should sum of RES give MEM: X used? or maybe sum of VIRT?
share|improve this question

migrated from stackoverflow.com Mar 18 '11 at 15:55

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Straight from top(1):

VIRT -- Virtual Image (kb) The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT will be calculated from the /proc/#/state VmSize field.)

VIRT = SWAP + RES.

SWAP -- Swapped size (kb) The swapped out portion of a task's total virtual memory image.

RES -- Resident size (kb) The non-swapped physical memory a task has used.

RES = CODE + DATA.

CODE -- Code size (kb) The amount of physical memory devoted to executable code, also known as the 'text resident set' size or TRS.

DATA -- Data+Stack size (kb) The amount of physical memory devoted to other than executable code, also known as the 'data resident set' size or DRS.

SHR -- Shared Mem size (kb) The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.

Also read Linux ate my RAM.

share|improve this answer
    
Thanks but knew that linux didn't eat my memory, PID 8506 uses it I want to know what's VIRT in this case and whats RES for 8506 –  bua Mar 18 '11 at 11:59

Your Answer

 
discard

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