Why can't I clear the RAM cache on my VPS?
What this is
You've noticed a lot of memory listed as cache/buffers and want to "free" it. The short answer: you don't need to, and you shouldn't. Linux has decades of refined memory management built in; it uses otherwise-idle RAM to cache frequently accessed files, and it releases that cache automatically and instantly the moment your applications need the memory. It will never let the system run out of memory just to keep things cached.
Why clearing it hurts
The cache is pure upside: reads served from RAM instead of disk make your entire VPS faster. Forcing it empty (the drop_caches trick) doesn't create memory your apps couldn't already claim, it just throws away the speed boost, and Linux has to rebuild the cache from disk afterwards. It solves no real problem and creates a small one.
If a monitoring tool is scaring you by counting cache as "used", read My VPS is using too much memory, the available column in free -h is the number that matters, and our panel Graphs already measure it correctly. The long-form explainer: linuxatemyram.com.
The one takeaway
If available memory is healthy, there is nothing to clear. If it isn't, clearing cache won't help, find the process eating RAM or upgrade the plan.
Still need help?
You can open a support ticket. So we can help on the first reply, it's worth mentioning:
- the VPS hostname or IP,
- the output of
free -h, - what made you look at memory in the first place (slowness, crashes, a graph).
Related questions
- "How do I clear cached memory on my VPS?"
- "Should I use drop_caches to free RAM?"
- "Why is so much memory shown as buffers/cache?"
- "Does clearing the cache speed up my server?"