Skip to content

Instantly share code, notes, and snippets.

@jefflarkin
Created November 1, 2010 20:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefflarkin/658822 to your computer and use it in GitHub Desktop.
Save jefflarkin/658822 to your computer and use it in GitHub Desktop.
A quick-and-dirty way to get the memory usage of the current process in Linux. Read /proc/self/status. The line VmHWM will tell you the memory highwater mark (max used) and VmRSS will give you the current memory usage.
:) cat /proc/self/status
Name: cat
State: R (running)
SleepAVG: 89%
Tgid: 13668
Pid: 13668
PPid: 24697
TracerPid: 0
Uid: <removed>
Gid: <removed>
FDSize: 256
Groups: <removed>
VmPeak: 3816 kB
VmSize: 3816 kB
VmLck: 0 kB
VmHWM: 648 kB
VmRSS: 648 kB
VmData: 164 kB
VmStk: 96 kB
VmExe: 20 kB
VmLib: 1348 kB
VmPTE: 20 kB
Threads: 1
SigQ: 0/65536
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000000
SigCgt: 0000000000000000
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
Cpus_allowed: 03
Mems_allowed: 00000000,00000001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment