Why is Linux using all my RAM?

My Linux-running laptop seemed to be a little bit sluggish, so I had a look at the amount of free RAM available – and did a double take:

Linux free RAM confusion
A few apps eating an entire 4GB? Say it ain't so!

This is on a 4GB machine with a web browser (6 tabs) open, email client, code::blocks IDE and totem to play some music. How can that devour my entire 4GB?

Answer: It can’t. Or at least it’s not! The Linux kernel is in fact using free RAM as a disk cache to keep your most often used data in memory and thus speed up the system. As soon as that RAM is actually needed for applications, then it’s instantly made available. This is in theory like the Windows Superfetch service (which is the first thing I disable on any Windows machine I’m forced to co-exist with), only the Linux version actually works well without perpetually thrashing the pants off the hard drive.

What’s really happening is this:

Linux free RAM in reality
It ain't so =D

For the exact workings, please see the excellent (and indeed excellently named) site “Help! Linux ate my RAM!” – http://www.linuxatemyram.com/.

Bit of a PEBKAC moment, there ;-)

One thought on “Why is Linux using all my RAM?”

  1. Many Linux users are still not sure why their system have such a low free ram? And many people believe that Linux is bad at memory management. It is just a myth, actually linux is better at Ram management and optimizing applications that run on it.

    What linux does is keep the cache on RAM and load applications from that cache, and as memory usage of a application rises, it frees ram cache and assign that to the application.

    Well time has come to put that myth to rest as Maaz Shah from Cloudways recently busted it by gving practical example: http://www.cloudways.com/blog/linux-ate-my-ram-memory-myth-busted/

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.