Ubuntu Eats My Memory

Joris Dobbelsteen Joris at familiedobbelsteen.nl
Wed Oct 17 15:27:05 UTC 2007


>-----Original Message-----
>From: ubuntu-users-bounces at lists.ubuntu.com 
>[mailto:ubuntu-users-bounces at lists.ubuntu.com] On Behalf Of 
>Brian Fahrlander
>Sent: woensdag 17 oktober 2007 16:09
>To: Ubuntu user technical support,not for general discussions
>Subject: Re: Ubuntu Eats My Memory
>
>Ruben Laban wrote:
>
>> In your output of top it shows "1383868k cached". So basicly there's 
>> roughly 1.3GB of memory 'in use' as cache. If you'd use the command 
>> "free -m", you'd see that the cache isn't 'really' using the memory. 
>> Cache memory can be freed when a program needs it.
>
>     Yeah, the Linux memory system is fabulous. I once was 
>working with a  set of full-page newspaper-sized JPGs. Each 
>one was about 10M or more, and there were 200 or so on the 
>volume.  I wanted to copy them someplace; I was watching TV at 
>the time, and didn't realize how much memory this was going to take.
>
[snip]
>
>     Linux actually _uses_ memory; whatever's just sitting 
>around, it uses the space to hold library routines and things, 
>ready at a millisecond's notice to dump them and make room for 
>'real' storage. 
>It's a very sweet design!

Your assumptions made are not true (in very nice working). They indicate
complete lack of understanding how the virtual memory is implemented in
any modern operating system (Windows/Linux/*BSD/Solaris/...).

What you are missing is the different INTERPRETATIONS you get when you
ask how much memory "is used".

For Windows (NT4/2000/XP) you get the amount of memory actually in use
by applications + kernel. This figure doesn't represent the amount of
file cache in use, which is indicated in the task manager under the
"Performance" tab as "System Cache". In fact, you can have a situation
where application+kernel + file-cache is larger than the total memory
available (hint: swap).
I don't know how with Vista the value is interpreted.

For Linux the used memory is interpreted as memory that is either used
by the kernel, application or as file cache. So the value, while it has
the same name, means something completely different. In fact, the notion
of 'used' is Linux might be quite confusing to some users. Nevertheless,
I personally don't call the overcommit handling in Linux a 'sweet
design' (I would rather nominate NetBSD).

If you want better figures for Linux, try the "free" command. You will
get the following output:
===
             total       used       free     shared    buffers
cached
Mem:        256232     249192       7040          0         32
50076
-/+ buffers/cache:     199084      57148
Swap:       248996      23868     225128
===

I won't even vouch that any of these values are equivalent to the value
Windows provides. My best guess is that Windows "Used" = Linux "Used -
buffers - cached + swap_used". Also, Windows "System Cache" is
equivalent to Linux "Cached". Also, there is still the difference
between memory that is reserved/allocated by applications and memory
that is actually used.

A possible notable difference between Linux and Windows is that Linux is
much more aggressive in moving application to the swap space, in order
to keep its file cache as large as possible. Obviously both are not
ideal, but rather offer a different trade-off.


- Joris





More information about the ubuntu-users mailing list