VmSize = physical memory + swap?

I have a little question regarding VmSize, in the documentation that should be used when using memory.

However, on my system:

VmSize = physical memory + swap VmHWM is more like what the application will actually use.

[ root@sun ~]# free -m total used free shared buffers cached Mem: 12012 9223 2788 0 613 1175 -/+ buffers/cache: 7434 4577 Swap: 3967 0 3967 [ root@sun ~]# cat /proc/8268/status Name: mysqld State: S (sleeping) Tgid: 8268 Pid: 8268 PPid: 1 TracerPid: 0 Uid: 89 89 89 89 Gid: 89 89 89 89 FDSize: 512 Groups: 89 VmPeak: 15878128 kB VmSize: 15878128 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 7036312 kB VmRSS: 7036312 kB VmData: 15839272 kB VmStk: 136 kB VmExe: 10744 kB VmLib: 6356 kB VmPTE: 16208 kB VmSwap: 0 kB Threads: 265 SigQ: 0/96048 SigPnd: 0000000000000000 ShdPnd: 0000000000000000 SigBlk: 0000000000087007 SigIgn: 0000000000001000 SigCgt: 00000001800066e9 CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: 0000001fffffffff Seccomp: 0 Cpus_allowed: fff Cpus_allowed_list: 0-11 Mems_allowed: 00000000,00000001 Mems_allowed_list: 0 voluntary_ctxt_switches: 2567 nonvoluntary_ctxt_switches: 77 

Any idea on why? I am trying to get memory usage for this application in particular, but this result does not make sense.

Thanks.

+6
source share
2 answers

VmSize is the sum of all displayed memory ( /proc/pid/maps )

+4
source

VMsize is the "address space" that this process uses: the number of addresses available. These addresses should not have physical memory attached to them. (The attached physical memory is an RSS digit)

You can verify this by allocating a chunk of memory with p = malloc(4 * 1024 * 1024); and doing nothing for *p : VmSize will increase by 1K pages, but RSS will be (roughly) the same. (your program will have more addressable memory, but it does not access it, so memory does not need to be attached)

+5
source

Source: https://habr.com/ru/post/947576/


All Articles