This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

“Linux Is Eating My Ram” Myth Busted

Updated on  21st October

4 Min Read
Reading Time: 4 minutes

In my experience, as a system administrator, I have been asked a lot of questions about system eating up all the memory. In all fairness, it is not uncommon for an operating system to occupy the memory and release it when required.


There is a saying in Linux community: “Free memory is the waste of memory.”

What happens in Linux OS is that it borrows unused memory for disk caching. This makes memory to be apparently consumed by the operating system, but in real essence it is not “eating up RAM.”

But, the question stands: Why do we think Linux is mean when it devours RAM?

Linux is not mean. What it does is for the sake of speed. It makes caching much faster. It acts like a “bank” which keeps all the memory and a chunk of it is released when the need arises. Whenever an application needs more memory, a chunk is borrowed immediately and it is returned once the function is complete.

The common utilities in Linux to check free memory explain it a bit differently. Check out the screenshot below. In it, you can see that the amount of free memory is 168 MB whereas the cached processes are using 1261 MB of RAM.

You don’t really need to clear disk cache but if you insist you can do this by using the following code:

Once the cache is emptied, you can see the amount of free memory has increased.


Another question that I get (and I don’t know why I get it) is: How can we stop it?

My answer is simple: “WHY in the world you want to stop it?”

This free memory is usually invested in a technique that improves performance. Stopping this process will definitely decrease performance. Disk cache makes applications load faster and run smoother, but it NEVER EVER takes memory away from them! Therefore, there’s absolutely no reason to disable it!

Let’s try an experiment:

Here, we have a small script that will keep on consuming memory. Let us see how it goes. First, we will check the free memory.

Here you can see the free memory shown is 156 MB. OOM Killer should just end this process and hopefully the rest will remain undisturbed. We need to disable swap for this.

You will observe something like this.

Even though it showed 156 MB “free”, it didn’t stop the application from grabbing 1347 MB.

Afterwards, the cache is pretty empty, but it will gradually fill up again as files are read and written.

However, you do need to understand that you cannot run on the same amount of RAM as you grow. Each visitor to your website uses a minute amount of RAM when they are visiting your website. As your website becomes popular, you will get more visitors and there will come a time when you will need more RAM. On Cloudways, you can increase RAM by scaling your server size from the Vertical Scaling section inside the Server Management tab.

Vertical Scaling Cloudways

At Cloudways, we want to provide the easiest cloud hosting platform ever. If you are interested, start your free trial from the banner below.

Many thanks to LinuxAteMyRam for this study.

Share your opinion in the comment section. COMMENT NOW

Maaz Shah

Maaz Shah works as System Engineer for Cloudways. His days are spent in tackling technical troubles.

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.