Memory: Used, Free, Cached & the "Available" Metric

System Monitoring & Performance Diagnosis

Chapter 3 · Memory: Used, Free, Cached & the "Available" Metric

Chapter 1's snapshot showed only 412.6 MiB "free" out of 16 GB total, alongside heavy swap usage — and deliberately left both unexplained. This chapter resolves both: why the low "free" figure is very likely a false alarm, and why the swap figure deserves real attention, though — as the closing worked example shows — not always for the reason it first appears to.

The Classic "No Free Memory" False Alarm

Linux treats unused RAM as wasted RAM. Rather than leaving memory sitting empty, the kernel fills it with a cache of recently-read disk data — the page cache — so a repeated read can be served instantly from memory instead of hitting the disk again. That cache shows up in buff/cache, and on any machine that's been running a while, it tends to consume most of whatever isn't already allocated to running processes.

Cached memory is reclaimable, essentially for free
Unlike memory a process is actively using, page cache can be dropped almost instantly the moment an application actually needs that RAM — there's no cost to reclaiming it, since the same data can simply be re-read from disk later if needed again. A low "free" number with a large "buff/cache" number isn't a shortage at all; it's the kernel using spare capacity productively, exactly as designed.

Reading free -h Properly

$ free -h total used free shared buff/cache available Mem: 15Gi 11Gi 402Mi 210Mi 4.3Gi 4.1Gi Swap: 2.0Gi 1.8Gi 154Mi
ColumnWhat it actually means
usedMemory genuinely allocated to running processes — the number closest to "real" usage
freeMemory touched by nothing at all — usually small on a healthy, active machine, and not a cause for concern by itself
buff/cacheReclaimable page cache — available the instant something else needs it
availableThe kernel's own estimate of how much memory a new application could get right now without needing to swap — the single most useful number here
Look at "available" first, not "free"
"Free" answers a narrow, mostly uninteresting question — how much memory is completely untouched. "Available" answers the question that actually matters for diagnosing memory pressure: how much memory could this system hand to a new process right now, accounting for cache it could reclaim instantly. A low "free" figure next to a healthy "available" figure is not a problem.

When Memory Pressure Is Real: Swap

Swap is fundamentally different from cache. When physical RAM is genuinely insufficient, the kernel moves active, in-use memory pages out to disk to free up space — a process that's orders of magnitude slower than RAM itself, since it involves real disk I/O for data a process actually needs. Unlike reclaiming cache, swapping has a real, measurable performance cost.

Total swap used isn't the same as swapping actively happening right now
A high total swap-used figure can be historical — memory that was pushed out during an earlier period of pressure, or proactively swapped out because it was cold and unused, and simply hasn't been swapped back in since nothing has needed it. What actually indicates an ongoing, active problem is vmstat's si and so columns (swap in/out per second) showing sustained, nonzero movement — not the total figure alone.

The OOM Killer: When Memory Pressure Gets Severe Enough

If physical RAM and swap are both genuinely exhausted, Linux's Out-Of-Memory (OOM) killer steps in and picks a process to terminate outright, freeing its memory by force. A process that simply vanishes, with no crash log of its own and no obvious cause, is a classic OOM-kill symptom — confirmed by checking the kernel's own log:

$ dmesg | grep -i "killed process" [124560.221033] Out of memory: Killed process 18832 (java) total-vm:4194304kB, anon-rss:3801216kB # or, on a systemd-based system $ journalctl -k | grep -i oom

Reading these entries correctly is exactly the log-reading discipline this site's own Logging & Log Analysis (log1) course covers in depth — this is one specific, high-value example of it, applied to a memory-pressure investigation specifically.

Windows' Own Memory Model

Windows doesn't expose the exact same free-vs-cache split. Task Manager shows figures like "In use," "Available," "Committed," and "Cached," alongside a "Standby" list — memory holding recently-used file data that can be reclaimed, conceptually similar to Linux's page cache. Task Manager's own "Available" figure already accounts for reclaimable standby memory, in the same spirit as Linux's "available" column, though the two aren't a precise one-to-one match.

Working Example: Fully Reading Chapter 1's Snapshot

Chapter 1 showed 412.6 MiB free, 4417.8 MiB buff/cache, and swap at 1890.3 of 2048.0 MiB used. The low "free" figure is exactly this chapter's false alarm — a healthy 4.3 GiB of reclaimable cache sits right next to it. The swap figure, at first glance, looks like a serious active problem. But checking whether it's actually active right now means returning to Chapter 2's own vmstat sample from this same machine:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 7 0 1935872 422528 145200 4523000 0 0 2 8 980 2100 85 9 4 2 0 8 0 1935872 415200 145200 4519200 0 0 0 4 975 2050 88 8 3 1 0 6 0 1935872 409600 145200 4517800 0 0 0 0 960 1980 86 9 4 1 0

si and so are both 0 across every sample — nothing is actively swapping in or out right now. Combined with Chapter 2's own finding of 0.0 wa, the picture is consistent and honest: this machine's high swap-used figure is a leftover from an earlier period of pressure, not an active crisis, and the actual, currently-active bottleneck is exactly what Chapter 2 already found — genuine CPU contention. Memory isn't this machine's real problem right now; it's a secondary artifact worth noting, not the headline finding.

Hands-On Exercises

Exercise 1

Explain why a low "free" memory figure next to a large "buff/cache" figure isn't evidence of a memory shortage, using this chapter's own reasoning about page cache.

📄 View solution
Exercise 2

Explain the difference between a high total swap-used figure and actively-occurring swapping, and which specific metric this chapter says distinguishes the two.

📄 View solution
Exercise 3

In this chapter's worked example, explain why the machine's high swap-used figure was ultimately judged not to be the active problem, and what the real, currently-active bottleneck turned out to be.

📄 View solution

Chapter 3 Quick Reference

  • A low "free" figure is usually a false alarm — Linux deliberately fills spare RAM with reclaimable page cache (buff/cache)
  • "Available" (in free -h) is the number that actually matters — an estimate of usable memory accounting for reclaimable cache
  • Swap usage is the genuine warning sign, but a high total isn't the same as actively swapping right now — check vmstat's si/so columns to tell them apart
  • When memory and swap are both exhausted, Linux's OOM killer terminates a process outright — confirm with dmesg/journalctl -k
  • Windows' "Standby" list plays a similar role to Linux's page cache, though the two aren't an exact match
  • Next chapter: Disk I/O: IOPS, Throughput & Latency