In Linux, to see if a process is consuming memory, execute the following command to replace the [PID] with the corresponding process's PID number:
The code is as follows:
Cat/proc/[pid]/status
Description
In addition to memory information, the information stored in the/proc/[pid]/status includes process IDs, signals, and so on, which only describes memory-related information temporarily.
Field description
Peak of virtual memory used by the Vmpeak process
The size of the virtual memory currently used by the vmsize process
The size of the physical memory that the VMLCK has locked (the locked physical memory cannot be swapped to the hard drive)
Peak of physical memory used by the VMHWM process
The size of the physical memory currently used by the VMRSS process
The size of the data segment that the Vmdata process occupies
The stack size that the VMSTK process occupies
The size of the code segment that the Vmexe process occupies (excluding libraries)
The amount of memory consumed by the dynamic libraries loaded by the VMLIB process (which may be shared with other processes)
Page table size occupied by the VMPTE process (number of exchange table entries)
The size of the swap area used by the Vmswap process
Example
Displays the memory information for the process cron, gets the process ID via pidof cron, or through Ps-aux | grep cron lookup Process ID.
The code is as follows:
$ cat/proc/1161/status
Name:cron
State:s (sleeping)
tgid:1161
ngid:0
pid:1161
Ppid:1
tracerpid:0
uid:0 0 0 0
gid:0 0 0 0
Fdsize:64
groups:0
vmpeak:23792 KB
vmsize:23656 KB
vmlck:0 KB
vmpin:0 KB
vmhwm:1040 KB
vmrss:1004 KB
vmdata:260 KB
vmstk:136 KB
Vmexe:40 KB
vmlib:2668 KB
vmpte:72 KB
vmswap:0 KB
Threads:1
sigq:0/15442
sigpnd:0000000000000000
shdpnd:0000000000000000
sigblk:0000000000000000
sigign:0000000000000000
sigcgt:0000000000010001
capinh:0000000000000000
Capprm:0000001fffffffff
Capeff:0000001fffffffff
Capbnd:0000001fffffffff
seccomp:0
Cpus_allowed:3
Cpus_allowed_list:0-1
mems_allowed:00000000,00000001
mems_allowed_list:0
voluntary_ctxt_switches:151
nonvoluntary_ctxt_switches:0