[plug] Question about memory usage

Gavin Rogers grogers at vk6hgr.echidna.id.au
Tue May 2 23:18:04 WST 2006


At 01:38 PM 2/05/2006, you wrote:

>Now that my system is not running XWindows,  I have run top, to check on 
>the system.
>
>In the memory line, it shows:
>Mem: 762936k total
>      536004k used
>      226932k free
>      112788k buffers
>
>Or, those were the figures while I was writing this. The amount consumed 
>by the buffers keeps increasing, as does the amount used. While I wrote 
>that sentence, the buffers usage went up to 112888, and is now 112940.
>
>Is the system supposed to do this, and, to use so much memory, when it is 
>not running any GUI?

In a word, yes.

Memory allocated temporarily for disk cache etc is counted in the "buffers" 
amount. Really, it is actually free memory that's ready at any time to stop 
being used as a buffer and allocated to programs.

A better program than top to show free memory is the 'free' program.

[grogers at voyager] ~$ free -m
              total       used       free     shared    buffers     cached
Mem:           503        493         10          0         14        140
-/+ buffers/cache:        338        164
Swap:          571         20        551


The line to look at would be the -/+ buffers/cache line. I have 338Mb of 
RAM in use by programs with 164Mb free. If I load a program that requires 
more than the 10Mb of comletely free RAM the kernel will try and take some 
RAM from that used by buffers/cache. If that is still not enough, then the 
kernel will swap out programs that have not used RAM in a while out to disk 
to try and free up memory.

If all of that fails, then you will get the dreaded "malloc() failed: out 
of memory" or similar error. The program should crash but it shouldn't 
crash your system.


Regards,


---
       Gavin Rogers                     |  Amateur radio station VK6HGR
     http://www.livingwaters.com/good   |     http://vk6hgr.ampr.org/
     ICQ: 17230395       MSN/Skype/Email: grogers at vk6hgr.echidna.id.au




More information about the plug mailing list