Memory management in Linux
This is a prefab for me to paste into tickets whenever a customer is confused about “free” and “used” memory.
Memory in Linux isn’t just black and white, “used” vs “free”. Rather, there are a few states, such as cached and buffered, in addition to used and free. Each of these states has a specific purpose — buffered memory is used for block devices, while cached memory is used for disk objects, to speed up access. Free and used are just as they sound.
The catch, however, is that both cached and buffered memory can be released instantly, should an application or the system require more memory just to run. For all intents and purposes, both cached and buffered memory can be considered “free”, even though they’re actively in use to speed up the running applications by reducing the amount of disk accesses.
top breaks down all of this, whereas Webmin abbreviates this information. The actual “free” memory is, essentially, used minus buffers minus cached. Right now, for example, your server is reporting 2007MB total RAM, 108MB of which is free. 42MB is buffered and the majority, 1612MB is cached — while only 108MB is completely free, 1763MB is available to be freed. Completely free memory is a waste of the fastest medium available in your server, and Linux makes sure to take advantage of it!