Why Linux ‘Ate My RAM’: Understanding free, buffers, and cache
Linux appears to consume most of a system’s RAM, but the free command’s output, including buffers and cache, actually reflects memory used for performance optimization; this article explains the distinction, how to interpret free’s columns, and demonstrates the impact with a 1 GB file read experiment.
When Windows Explorer shows memory usage above 80%, running large programs feels sluggish because swapping occurs; on Linux, the free command often shows high memory usage even when few applications run, which is due to Linux’s memory management design.
free command introduction
Running free -m on a lab file server yields output such as:
Mem: total=3920MB, used=1938MB, free=1982MB, shared=0MB, buffers=497MB, cached=1235MB
Buffers are data waiting to be written to disk, while cache holds data read from disk for future use; both improve I/O performance.
Subtracting buffers and cache from used memory gives the amount actually occupied by applications (205 MB), and adding them to free memory gives the true amount of memory available to programs (3714 MB).
Swap space is unused in this example, indicating sufficient RAM.
Memory classification
From the OS and user perspectives, memory can be categorized as:
Used : memory taken by applications.
Free (available) : memory not used for anything.
Buffers/Cache : memory used by the kernel for I/O caching; it can be reclaimed quickly for applications, so users often consider it free.
Therefore, the third line of free output (‑/‑ buffers/cache) shows memory usage from the user’s viewpoint.
Benefits of buffers/cached
Linux employs buffer cache and page cache to speed up disk I/O. Data read from slow block devices is kept in memory, allowing subsequent accesses to bypass the disk. When memory becomes scarce, the kernel can drop cached pages instead of swapping, preserving performance.
Experiment proof
An experiment reads a 1 GB file twice:
Generate a 1 GB file.
Clear the cache.
Read the file and measure time (≈18 s).
Read the file again (≈0.3 s), a 60‑fold speedup thanks to caching.
References
Discussion on “Linux ate my RAM” (Google Groups).
linuxatemyram.com article.
Additional experiments on cache impact.
Blog post introducing the free command.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
