简体   繁体   中英

Should i look at VmSize, VmRSS, or some combination for memory stats on linux?

I am trying to calculate appropriate sizing data on a linux system for a product and am looking to determine memory usage. The way I am approaching it so far is by running:

cat /proc/<pid>/status

When looking at the output, but I am not sure which figures are relevant. For example:

VmPeak: 19662464 kB
VmSize: 18344416 kB
VmLck:         0 kB
VmHWM:   5942980 kB
VmRSS:   4734832 kB
VmData:  2108608 kB
VmStk:       120 kB
VmExe:      9256 kB
VmLib:    304448 kB
VmPTE:     10316 kB

I would think i would use VmSize (Virtual Memory right?) or VmRSS (Private Memory right?) or some combination to determine this, but I am not sure. Any pointers on correctly calculating the memory usage of a process in Linux?

I think the replys were not answering to your specific question. The key point is that the important value you have to take care is the RAM memory used in the system by your process.

Therefore:

  • In top is shown as residual memory: 'RES' column
  • In the '/proc//satus: 'VmRSS' value
  • In pmap command: 'RSS' total column value (at the bottom)

Cheers,

Antonio

There are some commands that can help you determine memory usage for a given process:

try pmap or pmap -x

you could also use the old and good top command

vmstat would be useful too.

A more precise information about the memory map of process of pid 1234 can be given by reading (eg with cat command) the /proc/1234/maps or /proc/1234/smaps files. You can also use the pmap command, eg pmap 1234

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM