Thursday, October 14, 2010

Linux memory usage

  • Do a free command, see the used, free memory, as well buffers and cached memory
        

  • Do a total of all running procecss memory usage, including init, the kernel is not reported in "ps"
$ ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww --sort=pid|grep -v RSS|awk '{total=total+$3}END{print total}'

2194756
  • How much used for kernel
Total physical RAM - buffers - cached - total running process RAM usage - free:
8175520 - 535184 - 3158588 - 2194756 - 2105836 = 92236KB

Notes:
  • Reference: http://mail.nl.linux.org/linux-mm/2003-03/msg00077.html
  •  Memory Buffers - A page cache for the virtual memory system. The kernel keeps track of frequently accessed memory and stores the pages here.
  • Memory Cached - Any modern operating system will cache files frequently accessed.
  • VSIZE (Virtual memory SIZE) - The amount of memory the process is currently using. This includes the amount in RAM (including buffers/cached) and the amount in swap.
  • RSS (Resident Set Size) - The portion of a process that exists in physical memory (RAM).
  • The kernel - The kernel will consume a couple of MB of memory. The memory that the kernel consumes can not be swapped out to disk. This memory is not reported by commands such as "free" or "ps".

No comments:

Post a Comment