Sungju's Slow Life

Personal journal


How to check memory usage in Linux – part 1. User space

Here I am explaining how to check memory usage in the user space, especially from the command line. There are two perspective to see memory usage – System level and per-process level.

System level memory usage check

  • free
  • top
  • /proc/meminfo
  • /proc/buddyinfo
  • /proc/pagetypeinfo
  • vmstat
  • /var/log/sa/sa[r]*
  • /proc/vmstat
  • /proc/slabinfo
  • slabtop
  • ipcs

Per-process level memory usage check

System level memory usage check

free

top

/proc/meminfo

/proc/buddyinfo

/proc/pagetypeinfo

vmstat

/var/log/sa/

You can get historical system data which also include memory usage history. There are some nice tools that is working with this sar data.

/proc/vmstat

/proc/slabinfo

slabtop

ipcs

Per-process level memory usage check

ps

pmap

/proc/<pid>/maps

/proc/<pid>/smaps



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: