Home > Uncategorized > Memory management with linux

Memory management with linux

Tools like “top” o “cat /proc/meminfo” do not really help when trying to find out how much memory is really used by the system. “htop” does a better job but instead try:

free -m

especially the “-/+ buffers/cache” line will tell you how much RAM is really still available. How to demand your memory back from the system?

echo 3 > /proc/sys/vm/drop_caches

This will free the page cache, dentries and inodes (this is the blue and yellow marked buffer/cache part in htop).

Categories: Uncategorized Tags: , , ,
  1. robert
    September 5th, 2012 at 14:37 | #1

    Also: The vm cache poses a problam on NUMA machines.
    Let’s have a look at the following situation: A multi socket server running one process that writes huge files.
    The vm cache will be filled to a certain level but the memory for the vm cache will primarly be allocated on the numa domain that houses the IO-intense task. Other tasks on that numa domain (even after the IO intense task finished) will not be able to allocate memory from their home node anymore which results in much lower bandwidths and higher latencies for main memory accesses. The reason is that there is still memory available (on the other nodes) and therefor the vm cache is not freed. Worst of all: this will totally ruin your performance for parallel programs as the tasks on one numa domain will need much longer.

    It might be wise to check
    /sys/devices/system/node/node*/meminfo
    on NUMA systems. These files tell you everything for each NUMA domain 🙂

  1. No trackbacks yet.