Abstract
grep MemAvailable /proc/meminfo
MemAvailable
: best single metric to know how much RAM you can safely use. It isMemFree
+ some of Memory Buffer + some of Memory Cache and some other reclaimable
MemFree
is misleading
MemFree
shows only completely unused memory.This value is usually very low on a healthy Linux system, and thatโs intentional. Linux aggressively caches disk and file data in RAM to speed things up.
Memory Buffer
- File System metadata cache
Memory Cache
- File content cache
Out of Memory
- This happens when systems run out of usable RAM and cant satisfy memory allocation requests, not even by killing Memory Cache or swapping. At this point, Kernel is forced to kill one or more processes to free up memory
Who to kill?
Kill the one with high memory usage, low priority and high
oom_score
.