free -h, see almost no free RAM, and think your Linux box is quietly falling apart? Yeah, that feeling is common. And most of the time, it’s wrong.Linux page cache is the reason. The kernel hates wasted memory, so it uses spare RAM to cache file data and speed up disk I/O. That’s why your system can look “full” even when it has plenty of memory available for real work. This is normal, healthy behavior, and honestly, it’s one of the reasons Linux feels fast under load.
Key Takeaways
- Linux uses unused RAM for the page cache to speed up file reads and writes.
- Low
freememory on Linux usually does not mean you’re out of RAM. - The most useful field in modern
freeoutput is available, notfree. buff/cacheincludes reclaimable memory such as page cache and some kernel caches.- If applications need memory, Linux can reclaim page cache automatically.
- You should worry when available memory is very low, swap usage keeps growing, or the OOM killer appears in logs.
- Clearing cache manually is rarely a good idea outside benchmarking or testing.
What Is Linux Page Cache?
The Linux page cache is RAM used to keep file data in memory after the kernel reads it from or writes it to storage. If the same data is needed again, Linux can serve it from RAM instead of hitting the disk again. That’s much faster.
The Thomas-Krenn Wiki puts it simply: Linux stores data read from or written to disks in unused memory, so later access can come directly from cache. It also notes an important historical detail: older Linux kernels had both a page cache and a buffer cache, but since kernel 2.4 they’ve effectively been combined into one page cache.
So when people say “Linux ate my RAM,” what usually happened is this:
- you read a lot of files
- Linux cached them
freenow shows less unused memory- but that memory is still reclaimable if needed
That’s not waste. That’s the kernel doing its job.
Why Linux Page Cache Makes RAM Look Full
Here’s the part that trips people up: Linux treats unused RAM as an opportunity.
Instead of leaving memory idle, the kernel fills it with useful cached data:
- file contents
- metadata
- write buffers
- reclaimable slab allocations
According to linuxatemyram.com, a healthy system will often show free memory close to zero after it has been running for a while. That sounds scary until you look at available memory. That number tells you how much RAM can be used for new applications without swapping.
And that’s the real metric.
Free vs Available Memory on Linux
On modern systems, free output looks like this:
free -hExample:
total used free shared buff/cache available
Mem: 15Gi 6.1Gi 1.9Gi 301Mi 7.5Gi 8.8Gi
Swap: 979Mi 0Bi 979MiFrom the free(1) manual page:
- free = unused memory only
- buff/cache = buffers plus page cache and reclaimable slabs
- available = estimate of memory available for starting new apps without swapping
That last field matters most. As the man page explains, available accounts for page cache and the fact that not all cached memory is equally reclaimable, so it’s a better estimate than plain free.
In other words, “free RAM” is a lousy health check on Linux.
What Does buff/cache Mean in Linux?
The buff/cache column combines:
- Buffers: temporary storage for raw disk blocks
- Cache: file data in the page cache plus reclaimable slab memory
The proc_meminfo(5) documentation backs this up. It defines:
Buffersas relatively temporary storage for raw disk blocksCachedas in-memory cache for files read from diskMemAvailableas an estimate of RAM available without swapping
That also explains why buff/cache can get large on busy file servers, database hosts, CI runners, and developer workstations.
And yes, it’s supposed to.
Linux Page Cache in the Real World
One of the better real-world examples comes from InterSystems. They describe a Linux database server where “free memory” dropped sharply around 2 a.m. That looked alarming at first. But the drop lined up with a burst of large sequential reads from a backup job.
So what happened?
The backup filled the filesystem page cache. Linux used spare RAM to cache those reads. The system looked low on free memory, but available memory remained high, which meant the server still had plenty of headroom.
That’s classic Linux behavior. I’ve seen the same thing on build servers. Run a big backup, restore, or container image pull and suddenly everyone thinks the machine is out of memory. Usually it isn’t.
Why Linux Doesn’t Immediately “Free” RAM
A common question is: if a process exits, why doesn’t RAM instantly go back to a big empty pool?
Because that would be wasteful.
As several long-running admin discussions on Super User and Server Fault explain, Linux keeps useful file-backed pages around because the same data may be needed again. Throwing it away immediately would just force more disk I/O later.
So the kernel makes a tradeoff:
- keep recently useful pages in RAM
- reclaim them only when something else needs memory
That’s why cached memory is often described as “used but available.”
How to Check Linux Page Cache and Memory Correctly
If you want a quick view, use:
free -hFocus on:
available- swap usage
- whether swap is actively growing over time
For more detail, inspect /proc/meminfo:
grep -E 'MemTotal|MemFree|MemAvailable|Buffers|Cached|Dirty|Writeback|Slab|SReclaimable' /proc/meminfoUseful fields:
MemAvailable: best quick estimate of usable RAMCached: page cache sizeDirty: pages waiting to be written to diskWriteback: pages actively being flushedSReclaimable: kernel cache that may be reclaimed
You can also watch memory over time:
watch -n 1 free -hOr combine it with I/O stats:
vmstat 1
iostat -xz 1That combo makes cache-heavy workloads much easier to understand.
When Low Free Memory Is Actually a Problem
Most of the time, low free memory is harmless. But there are real warning signs.
Both Red Hat and linuxatemyram.com suggest paying attention when:
- available memory is close to zero
- swap usage keeps increasing or fluctuates
- the OOM killer appears in logs
Check for OOM events with:
dmesg | grep -i oomOr:
journalctl -k | grep -i oomIf available is healthy and swap is stable, your system is probably fine. If available is collapsing and swap churn is growing, now we’re talking about genuine memory pressure.
Should You Clear the Linux Page Cache?
Usually, no.
Dropping page cache hurts performance because it throws away useful cached data. The whole point of the cache is to avoid expensive disk access. Wiping it just makes the next reads slower.
That said, there are valid reasons to do it:
- benchmarking cold-start performance
- testing storage behavior without warm cache
- reproducing a memory issue in a lab
If you really need to clear cache, the common command is:
sync
echo 3 | sudo tee /proc/sys/vm/drop_cachesThe sync flushes dirty pages first. Thomas-Krenn’s page cache example also shows how dirty pages drop to zero after sync.
But don’t turn this into a cron job. That’s a self-inflicted slowdown.
Linux Page Cache and Write Behavior
Page cache is not only about reads. Writes go there too.
When an application writes data, Linux often writes it first into memory as dirty pages. Those pages are later flushed to storage by the kernel. That means write calls can return quickly while the kernel handles actual disk writeback in the background.
You can see dirty data here:
grep -E 'Dirty|Writeback' /proc/meminfoThis is one reason Linux can smooth out storage performance. It batches and schedules writes instead of forcing every operation to block on disk latency.
FAQ: Linux Page Cache, Buffers, and Free Memory
Is buff/cache memory free on Linux?
Not exactly free, but mostly reclaimable. Linux can release much of it when applications need RAM.
Why is my Linux RAM usage so high?
Because Linux uses spare memory for page cache and kernel caches. High RAM usage alone is not a problem.
What should I look at instead of free memory?
Look at available memory, swap trends, and OOM events.
Is page cache the same as buffer cache?
On modern Linux, the old split is mostly historical. Since kernel 2.4, page cache and buffer cache were unified in practice.
Internal and External Reading
If you like Linux internals and systems behavior, you might also enjoy this related post on running Docker like a system engineer.
For formal definitions, the best external references are the free(1) manual page and the /proc/meminfo manual page. They’re dry, sure, but accurate.
Conclusion
Linux page cache is the reason your RAM is never really “free.” And that’s a good thing.
The kernel uses spare memory to cache file data, reduce disk I/O, and keep the system responsive. So when free -h shows tiny free memory, don’t panic. Check available, watch swap, and look for real pressure signals before assuming there’s a problem.
If you’ve been misreading Linux memory stats for years, welcome to the club. Try checking /proc/meminfo on one of your servers today, compare it with free -h, and you’ll probably spot the pattern right away. And if you want, leave a comment with a weird memory snapshot. Those are always fun to untangle.
Sources
Thomas-Krenn Wiki, Linux Page Cache Basics
https://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_BasicsHelp! Linux ate my RAM!
https://www.linuxatemyram.com/Michael Kerrisk, man7.org, free(1) — Linux manual page
https://man7.org/linux/man-pages/man1/free.1.htmlMichael Kerrisk, man7.org, proc_meminfo(5) — Linux manual page
https://man7.org/linux/man-pages/man5/proc_meminfo.5.htmlRed Hat Blog, Dissecting the free command: What the Linux sysadmin needs to know
https://www.redhat.com/en/blog/dissecting-free-commandInterSystems Developer Community, Understanding free memory on a Linux database server
https://community.intersystems.com/post/understanding-free-memory-linux-database-serverServer Fault, Meaning of the buffers/cache line in the output of free
https://serverfault.com/questions/85470/meaning-of-the-buffers-cache-line-in-the-output-of-freeSuper User, What used the Linux memory? Low cache, low buffer, not a VM
https://superuser.com/questions/764876/what-used-the-linux-memory-low-cache-low-buffer-not-a-vm