see a program's memory use
How much memory a program really uses, and which programs use the most.
Steps
-
ps aux --sort=-rss | headthe programs using the most memory, first (Linux)
-
ps -o pid,rss,vsz,cmd -p PIDone program: RSS is the memory it really holds, in KB
-
grep -E 'VmRSS|VmSwap' /proc/PID/statusits memory and its swap (Linux)
-
pmap -x PID | tail -1the total of every part of its memory
-
smem -k -P NAMEmemory shared counted fairly, by name (smem)
-
free -hthe whole machine's memory
Notes
- Put the program's number in place of PID:
pgrep -l NAMEfinds it. - macOS:
ps -o pid,rss,command -p PIDand Activity Monitor.
Commands used
pspmapfreetop
Each has a page in lore: lore ps opens it.
Related recipes
- find what killed a processA program vanished or says "Killed": usually the kernel ran out of memory and stopped it. Find out.
- what is slowing the machineSee whether the processor, the memory or a disk is the bottleneck, and which program is behind it.
- add a userCreate an account with a home folder and a password, and let it use sudo if it should.
- count the processorsHow many processors and cores this machine has, and what they are.