PROBLEM
My memory is full but the processes list is empty of heavy programs!
Usage:
Total memory is 4GB but only 400MB is free:
Monitor with htop
:
When sorting by %MEM
-> heavy programs only use 1% of memory!
Which process filled my RAM?
Best Answer
That's because the memory is filled with filesystem metadata (aka "buffers") and files' contents (aka "cached") cached by the kernel.
Since it's common for programs / users to access those kind of resources multiple times in a short timeframe and not using memory is a waste, the kernel caches them in order for them to be accessed faster than it would by reading them again from the disk.
The exact amount of cached data is reported on the 5th and 6th columns:
Since the cached data can be dropped immediately if the memory is required for something else, the cached data isn't really taken and is actually available for programs to use it.
The "real" (net of buffers / cached data) used / free memory is reported in the third row ("-/+ buffers/cache:"):
For easiness you could add a couple of aliases to print only the "real" used / free memory to
~/.bashrc
: