Re: memory usage interpetation

Johan Walles <[email protected]> Tue, 29 Apr 2003 08:57:25 +0200
Newsgroups gmane.comp.gnome.apps.bubblemon
Message-ID <[email protected]>
Forgot to CC my reply to the list.  Here it is...

   //Johan

-------- Original Message --------
Subject: Re: [Bubblemon-list] memory usage interpetation
Date: Tue, 29 Apr 2003 08:56:30 +0200
From: Johan Walles <[email protected]>
To: Piotr Romanus <p_romanus-/[email protected]>
References: <20030428195842.58864.qmail-IMHJdEE64COA/[email protected]>

This is FAQ #6.  From
"http://savannah.nongnu.org/cgi-bin/viewcvs/bubblemon/bubblemon/FAQ?rev=1.23&content-type=text/vnd.viewcvs-markup":

6. The amount of memory used reported by the applet is different from
   what [other program] says.  How come?

Free memory measuring on Linux (at least) is somewhat complicated.
What my applet shows is what most people would think of as free
memory.  Therefore, what my applet reports may not correspond to what
other programs say, but the numbers you get from my applet is what you
really want.

A more precise explanation follows.  If it's wrong in some way, or if
you know somewhere else where this is documented in some
comprehensible way, I'd appreciate it if you send a mail to the
mailing list ([email protected]).

Anyway, if we forget about swap for a while, here are the different
kinds of memory, and whether I treat them as "air" or "water":

* Free memory.  Just what you'd expect.  This adds to the "air".
* Used memory.  Just what you'd expect.  This adds to the "water".
* Shared memory.  Memory shared between two or more processes.  This
  adds to the "water".
* Buffers and cache.  Free memory that Linux uses for disk cache.
  When someone allocates more memory, buffers and cache are nuked, so
  this adds to the "air".

If we add swap space into the picture, what I show as the water level
is how much memory is "air" (as defined above) relative to the total
amount of electronic memory.  What I show as color changes is how much
"air" memory above the amount of electronic memory is being used.
Thus, when Linux starts swapping stuff out even though there's
electronic memory left, people watching my meter won't be confused by
this (I know I was before I changed it :-).

If you want to know more than this, have a look at the
get_censored_memory_and_swap() function in bubblemon.c.

   Cheers //Johan

Piotr Romanus wrote:
> How should I interpret memory usage info show by
> bubblemon? When I look put my curson on the applet it
> shows 261/1005Mb of memory used. Yet proc tells a
> diffrent story:
> 
> cat /proc/meminfo
>         total:    used:    free:  shared: buffers: 
> cached:
> Mem:  1055268864 1037660160 17608704        0 53182464
> 735948800
> Swap: 2089177088 18804736 2070372352
> MemTotal:      1030536 kB
> MemFree:         17196 kB
> MemShared:           0 kB
> Buffers:         51936 kB
> Cached:         713764 kB
> SwapCached:       4936 kB
> Active:         535764 kB
> Inact_dirty:    376404 kB
> Inact_clean:     40596 kB
> Inact_target:   190552 kB
> HighTotal:      130500 kB
> HighFree:         1020 kB
> LowTotal:       900036 kB
> LowFree:         16176 kB
> SwapTotal:     2040212 kB
> SwapFree:      2021848 kB
> Committed_AS:   365164 kB
> 
> I am on RedHat 8.0. 
> 
> Thanks,
> 
> Piotr Romanus
> 
> 
> =====
> Piotr Romanus
> 
> 
> _______________________________________________
> Bubblemon-list mailing list
> [email protected]
> http://mail.nongnu.org/mailman/listinfo/bubblemon-list