Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just viewed Hacker News. There is something mentioned like "Linux ate my RAM". How much is it true that linux consumes more RAM.

It will be helpful if someone can provide guide to remove cache of application.

At first my pc use to boot faster than it does now. After installing many programs, I'm facing this problem.

share|improve this question

closed as unclear what you're asking by Alvar, chaskes, guntbert, Braiam, Lucio Nov 13 '13 at 0:23

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

If you are going to use a source at least read it before you post a question. Everything is explained here. – Alvar Nov 11 '13 at 14:39
well if you read everything then you should know that this is an awesome feature and not something you should be bothered with. You wont have more lag from low amounts of RAM if you have disk-caching than if you wouldn't. If I remember correct Windows 7 does the same thing... – Alvar Nov 11 '13 at 14:52
It's still the worst idea I've ever heard. Everything will become slow and very very lagy. DON'T DO IT! – Alvar Nov 11 '13 at 15:15
I just want to clear cache of application. Application create cache so that they start quicker next time, isn't it? I just want to clear those application cache? – Habi Nov 11 '13 at 15:19
@Habi reading your comments and question, you are mixing several types of caching. Applications cache's aren't the same as memory cache. There are several kind of caches for different kind of uses cases. – Braiam Nov 11 '13 at 19:15

You didn't read the webpage. The link you provided is totally opposite to what you are claiming, so lets bring the information here for you:

What's going on?

Linux is borrowing unused memory for disk caching. This makes it looks like you are low on memory, but you are not! Everything is fine!

Why is it doing this?

Disk caching makes the system much faster! There are no downsides, except for confusing newbies. It does not take memory away from applications in any way, ever!

What if I want to run more applications?

If your applications want more memory, they just take back a chunk that the disk cache borrowed. Disk cache can always be given back to applications immediately! You are not low on ram!

Do I need more swap?

No, disk caching only borrows the ram that applications don't currently want. It will not use swap. If applications want more memory, they just take it back from the disk cache. They will not start swapping.

How do I stop Linux from doing this?

You can't disable disk caching. The only reason anyone ever wants to disable disk caching is because they think it takes memory away from their applications, which it doesn't! 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!

Now lets go with the boring explanation:

Linux philosophy is that unused RAM is wasted RAM, hence it needs to be filled with something useful, which is the cache. Caching means that instead of reading files from the old and slow HDD/SSD, it gets loaded in the RAM which is several fold faster than any of them, and at the same time it's translate into a faster programs start up, faster operations with frequently accessed data, a big gain in performance.

How to disable caching in Ubuntu?

You can't, or more like, you don't need to.

Does Ubuntu consume more RAM?

Against what we are comparing here? Linux and Windows? Ubuntu and other Linux distributions? If is Windows and Linux, Linux has better memory management and smaller memory footprint than Windows. If it's Ubuntu and another distro, is likely that you are trying to compare oranges and apples. You must take into account the Window/Desktop Manager used, kernel version, patches applied, etc.

How much is it true that linux consumes more RAM.

Again, against what we are comparing?

It will be helpful if someone can provide guide to remove cache of application.

WHY? The memory is there for any program to use if it's needed immediately they ask for them. The linux kernel doesn't count "cached" memory as "free" memory because is "used", but the cached memory is recoverable and gets destroyed immediately any application need it.

At first my pc use to boot faster than it does now. After installing many programs, I'm facing this problem.

Boot times is extremally subjective, and since you could have installed several programs, is not wonder that your boot times were slower. My boot time cuts around 75% once I removed Mongo DB which reviewed a 300MB database. Just that program added around 2 minutes to my boot time, I disabled to start it at boot time and now my system boots in >1 minute. You should review what programs starts at boot times and disabled them instead. Disabling the cache will not help to make your system boot faster and on the contrary will make your system overall performance worse.

Application create cache so that they start quicker next time, isn't it? I just want to clear those application cache?

Deppends the application, most applications doesn't use a cache without a very good reason. Browsers for example, has a cache. But this cache is of internet's objects (images, JavaScript, CSS, static content, etc) and the web page loads times are faster in subsequent visits. Other applications use cache's for storing thumbnails, frequently accessed data, etc. Those applications use in-disk caching. That cache isn't loaded in memory until the application starts, and it isn't count as cached memory.

Applications normally can't submit cached pages to the kernel. The memory cache is entirely controlled by the kernel and it dictates what should be cached.

share|improve this answer
+1 for good and complete explanation. Keep it up.. :) – Saurav Kumar Nov 11 '13 at 17:34
Braiam I,m not claiming anything and regarding website, it's true that title in Hackers News confused me. How could I know that? I am just asking this question to be sure not to claim anything. I've not just switched to linux. After knowing about it's memory management and it's performance only I've switched to this. – Habi Nov 11 '13 at 18:01
@Habi if that's the case, edit your question because that's the only interpretation that it leaves. – Braiam Nov 11 '13 at 18:03
Then help me edit it. My editing it poor Braiam. – Habi Nov 11 '13 at 18:05

Disabling disk cache or program cache will only slow down your computer. If you read the whole site that you've linked as source then you would know that is the case and we wouldn't have this discussion.

Hard drive cache and program cache store data in your memory. This makes program startup, usage and opening of files faster. Which it's why you want it.

The misunderstanding here (I think) is that you think that it allocates memory and therefor will limit your amount of RAM available. Which is exactly what it doesn't. It takes zero time to clear the cached RAM and fill it with loaded programs.

So there is no reason to disable this feature, I don't know if it's even possible since it's integrated in the core of Linux and not a feature of Ubuntu.

I just want to make clear cache is a good thing, it speeds up many programs and operations, and it's not just Ubuntu and Linux that have this feature. My Windows 7 gaming computer has the same features.

Having memory on your computer that isn't doing anything is just a waste of hardware it's not something you want, that's also why caching is a good thing.

share|improve this answer
Hey, I want to clear cache of application only. I want my OS to be in state of it's first boot. While, everything is new. When there is no cache does it ruin anything? No, it doesn't. Then how can you say it will ruin now? – Habi Nov 11 '13 at 15:21
@HAbi if an application needs the cached RAM then Linux will clear that cached RAM and the application will be able to use it. cached RAM is an awesome feature that makes your computer FASTER, disabling cache will make your computer SLOWER, it's not a good decision. – Alvar Nov 11 '13 at 15:25
@Habi I updated my answer. you say you don't want to switch to Ubuntu when you found this out, but the truth is that Windows and Mac does the same thing. It's because it's an awesome feature. – Alvar Nov 11 '13 at 19:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.