1 |
On Thursday 30 July 2009 14:17:26 Grant wrote: |
2 |
|
3 |
> OK, that's right. How can I find out if 4GB RAM (the current amount) |
4 |
> is enough? From what I understand of how Linux handles memory, it |
5 |
> will fill it up as quickly as possible, and then free it as necessary. |
6 |
> This makes it difficult to determine how much RAM is necessary from |
7 |
> watching top. |
8 |
|
9 |
top lies. This has been discussed here many times. All your memory tools |
10 |
essentially tell you how much memory an app is able to see into, and most of |
11 |
that memory is shared with other stuff (like libs). |
12 |
|
13 |
You can't tell how much memory an app is using in any meaningful way, you are |
14 |
not supposed to even look at it as it changes millions of times a second. What |
15 |
you are supposed to do is select an allocation algorithm that works well for |
16 |
you in practice and let the kernel do the heavy lifting. |
17 |
|
18 |
Yes, the kernel does grab as much memory as it can for buffers and cache, then |
19 |
release it on demands. All modern operating systems have done this for many |
20 |
years - Linux just doesn't try and hide that fact from you :-) |
21 |
|
22 |
> I read on this list that the kernel needs *some* swap, even just a |
23 |
> tiny amount, to function properly. Is that true? If so, do you think |
24 |
> it would be OK to put this tiny amount of swap on a cheap SSD? |
25 |
|
26 |
Not true. I have machines with zero swap and they work just fine. I am utterly |
27 |
unconcerned with out of memory conditions as whether you have swap or not, |
28 |
when virtual memory runs out, either way you have a horrible cockup that is |
29 |
hard to fix. Then there's the oom-killer that comes along, stomps all over |
30 |
everything and just makes it worse. |
31 |
|
32 |
-- |
33 |
alan dot mckinnon at gmail dot com |