Look at process memory usage under linux for an in depth understanding
- 2020-05-06 12:11:08
- OfStack
Dynamically view a process's memory usage
1 , top The command
top -d 1 -p pid [,pid ...] // Set to delay 1s The default is delay 3s
If you want to sort by memory usage, you can shift + m ( Sort by memory usage )
Statically view a process's memory usage
1 , pmap The command
pmap pid
2 , ps The command
ps aux|grep process_name
3 And check /proc/process_id/ subfolder status file
Name: php
State: R (running)
SleepAVG: 0%
Tgid: 21574
Pid: 21574
PPid: 10005
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 100 100 100 100
FDSize: 256
Groups: 16 100
VmPeak: 161740 kB
VmSize: 161740 kB
VmLck: 0 kB
VmHWM: 107144 kB
VmRSS: 107144 kB
VmData: 106192 kB
VmStk: 84 kB
VmExe: 5588 kB
VmLib: 7884 kB
VmPTE: 268 kB
Threads: 1
SigQ: 0/69632
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 00000001818040a7
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
Cpus_allowed: 00000000,00000000,00000000,0000000f
Mems_allowed: 1
The size of the task virtual address space VmSize
The size of the physical memory being used by the application VmRSS