Previously, on my desktop computer running Ubuntu 14.04, I had 4GB RAM, which I thought should be plenty. However, after being on for a while, my computer would seem to get slow. I have a system resource monitor app in my Gnome panel, which I assume represents the available RAM (?). It shows a dark green area as being "Memory", and a light green area as "Cache". The "Cache" would slowly grow until it filled the whole graph, and then programs would get slow to load, or it would take a while to switch programs.

I could alleviate the problem somewhat with this command, but eventually the computer cache fills up again, so it's only a bandaid:

sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

So, I figured I'd get more RAM, so I replaced one 2GB stick with an 8GB stick, and now I have 10 GB ram.

And my "cache" still slowly maxes out and my computer slows as a result. Also, sometimes the computer starts out with "cache" maxed when I first boot and log in. Not always though, I don't know if there's a pattern that determines why it happens.

Why is Ubuntu using up so much cache? Is 10GB not enough for Ubuntu?

Here's what my system monitor looks like in my Gnome panel. The middle square shows RAM usage. The light green area is the "cache":

Cache near max

This is my memory and swap history, which doesn't seem to include any information about "cache". I realize at this point I'm not totally clear on the difference between "cache" and "swap":

memory and swap

  • 1
    If your computer "seems to get slow" you should have a look at top or the process list and see if there's any process consuming more cpu time than you would expect. Having all your RAM "eaten up" by cache is no reason for concern as explained in the answers you already got.
    – Axel
    Jun 11, 2014 at 13:45
  • Was concern about free ram some time ago. Then I found this page: linuxatemyram.com There is nothing to worry about. If some process will need ram, it will be flushed seamlessly.
    – korro
    Jul 23, 2014 at 13:55

3 Answers 3


You probably need to reduce your swappiness.

The kernel considers it better to use the free ram as cache rather then evict cache pages and have the ram marked as truly free. Growing the cache is generally a good thing.

Now the question arises what to do when all the memory is allocated to cache and your application needs more memory. Often the right thing to do is to evict a page from the cache and hand it over to your app but occasionally it is beneficial to swap out a rarely used page, give that to your app and keep the cache intact.

This process is loosely controlled by /proc/sys/vm/swappiness. For more information please check the excellent answers to Why most people recommend to reduce swappiness to 10-20? and How do I configure swappiness?.


And my "cache" still slowly maxes out and my computer slows as a result.

You'll need to look elsewhere for the cause of your slowdown; the memory described as “cache” is the memory that the kernel can freely throw away if anything else needs RAM. It's things like data recently read from the disc.

This, while quite old, is still a reasonable description of some of the moving parts in the memory subsystem. As it says,

Linux has this basic rule: a page of free RAM is wasted RAM.

No matter how much RAM you have, your cache will grow to fill it. This is not a cause for concern. Far from it, it's a very significant performance optimisation - RAM is about 100 times faster than a fast SSD, so any time you don't have to read from disc is a huge win.


Your system uses so much cache, because it's there for the taking, and can help it go faster.

Caching in general is where we put a copy of something that is either slow to retrieve or slow to calculate somewhere that is faster to retrieve. A program might store the result of a calculation in memory, a web proxy might store a copy of a resource from the web on a machine on your LAN and, in this case, a system might store data from the hard drives in RAM (and some other data).

And because it makes the system go faster, it makes logical sense to use every kilobyte that's not being used by something else. The options for a chunk of memory that nothing else is using are after all:

                      |Use For Cache | Don't Use For Cache
Data needed again     |Faster system | No difference
Data not needed again |No difference | No difference

Therefore you should always use every bit of memory that's not doing anything for cache.

A system that has 10% of the RAM in use for various things, and 90% of it in use for cache should not be thought of as "maxing out". It should be thought of as 10% in use, with another 90% free and therefore being used for cache while nothing needs it.

However, if we consider swapping, this is almost the opposite of caching data from the disk in RAM: Where caching uses RAM to speed up I/O (and potentially other things), paging uses disk space to extend RAM.

So when the system has all its RAM being used, and it needs more, it has two options:

  1. Throw away some of the cache, since it's only an optimisation after all.
  2. Page out some RAM being used for something else.

There is no universal answer to just which of these is the best. The perfect answer depends on a bunch of things that can't be predicted, and even the best answer depends on a bunch of things that depend on your system set up and how you use it.

Note that these opposite actions do make sense simultaneously: One is about prioritising slow-to-get information you are likely to need, the other is about de-prioritising information you aren't going to need soon.

250MB isn't a lot, so I wouldn't be terribly worried, but for a high-RAM desktop system for interactive (rather than server) use, I might experiment with reducing swappiness, to change the balancing act here. This answer is very good on why it probably won't make much difference, but it's a reasonable thing to experiment with to see if it goes.

You've a much bigger problem to deal with first, which is that someone is running sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches" on your machine every now and then, which clears out quick-to-access data from otherwise unused RAM and forces the system to recalculate or re-retrieve what it should be able to just grab from memory. That's going to make the system slower, and the RAM a waste of money.

  • @Sergey it's the Android users that really need to read that paragraph. There are an awful lot of Android users who spend time clearing caches to "free" memory, then complaining that their phone has gotten slower, and spending even more time "free"ing memory…
    – Jon Hanna
    Jun 11, 2014 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .