[Asterisk-Users] memory consumption

Steven Critchfield critch at basesys.com
Fri Mar 11 09:37:57 MST 2005


On Fri, 2005-03-11 at 12:22 -0300, Matias G. wrote:
> Hi I'm using Asterisk CVS-HEAD-03/09/05-18:25:28, Debian 3.0 rc3 and a
> Pentium IV 2.4 Ghz 512 Mb.
> 
> When I boot my computer, top reads:
> Mem:    515824K total,    33852K used,   481972K free,     1292K buffers
> Swap:   979924K total,        0K used,   979924K free,    17052K cached
> 
> after two days running I have only 9000K free (less than 9 Mb) physical
> memory available... the only way I have found to recover the lost memory is
> to reboot the computer...

Sounds like you are a very new user to linux. You didn't show what the
the results look like after running for a while. I'll pull a copy from a
machine I have in production use.

top - 10:08:01 up 14 days, 37 min,  1 user,  load average: 0.51, 0.38, 0.29
Tasks:  46 total,   4 running,  42 sleeping,   0 stopped,   0 zombie
Cpu(s):  76.7% user,  23.3% system,   0.0% nice,   0.0% idle
Mem:    256152k total,   201724k used,    54428k free,     8384k buffers
Swap:   497972k total,    32912k used,   465060k free,   156968k cached

or

top - 10:09:46 up 346 days, 46 min,  1 user,  load average: 0.13, 0.05, 0.01
Tasks:  47 total,   2 running,  45 sleeping,   0 stopped,   0 zombie
Cpu(s):   0.3% user,   0.3% system,   0.0% nice,  99.3% idle
Mem:    254968k total,   245084k used,     9884k free,    36216k buffers
Swap:   497972k total,    17652k used,   480320k free,    21952k cached

What you need to gather from these outputs that is different from your
post boot output is the numbers in buffers and cached. Those come
directly out of free RAM. Linux as an OS will buffer and cache as much
as it has RAM to do so. 

If linux sees that an app is resident but not active, it will swap it
out for more buffers and caches. The cache can be dropped pretty quickly
if you need more RAM. Buffers can be flushed and freed. 

So to point out that in the first listing I provided there is  201724k +
32912k Memory for a total of  234636k used, but there is 8384k buffers +
156968k cache for 165352k of easily freeable memory leaving just 69284k
of real application space used.

Second example.
245084k + 17652k = 262736k total memory
36216k + 21952k = 58168k buffers and cache
262736k - 58168k = 204568k actual memory for applications.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list