What's going on?
Why is it doing this?
What if I want to run more applications?
Do I need more swap?
How do I stop Linux from doing this?
Why does top and free say all my ram is used if it isn't?
This is just a misunderstanding of terms. Both you and Linux agrees that memory taken by applications is "used", while memory that isn't used for anything is "free".But what do you call memory that is both used for something and available for applications?
You would call that "free", but Linux calls it "used".
| Memory that is | You'd call it | Linux calls it |
|---|---|---|
| taken by applications | Used | Used |
| available for applications, and used for something | Free | Used |
| not used for anything | Free | Free |
This "something" is what top and free calls "buffers" and "cached". Since your and Linux's terminology differs, you think you are low on ram when you're not.
How do I see how much free ram I really have?
Too see how much ram is free to use for your applications, runfree -m and look at the row that says "-/+ buffers/cache" in the column that says "free". That is your answer in megabytes:
$ free -m
total used free shared buffers cached
Mem: 1504 1491 13 0 91 764
-/+ buffers/cache: 635 869
Swap: 2047 6 2041
$
If you don't know how to read the numbers, you'll think the ram is 99% full when it's really just 42%.
