memory leak

Bill McCormick wpmccormick at covad.net
Sun Apr 25 04:49:58 UTC 2004


Cameron Simpson wrote:

>On 08:59 24 Apr 2004, Bill McCormick <wpmccormick at covad.net> wrote:
>| I appear to have a memory leak (avg 100k/sec) coming from the kernel or 
>| kernel module. At least when I look at top, sorted by memory, I don't 
>| see any user space processes getting larger.
>
>Then, probably, you don't really have a leak.
>
>[...]
>| procinfo:
>| Linux 2.4.20-6smp (bhcompile at porky) (gcc 3.2.2 20030222 ) #1 4CPU 
>| [billinux]
>| 
>| Memory:      Total        Used        Free      Shared     Buffers 
>| Cached
>| Mem:       1159560      113204     1046356           0       12612 
>|  27552
>| Swap:       257000           0      257000
>
>What I see here is a machine that hasn't run out of RAM yet and (therefore)
>hasn't used any swap at all.
>
>So what's probably happening is that every piece of data read the system
>does is being kept in RAM so that should something else want that data
>the OS doesn't have to go back to the disc for it. All decent OSes do
>this - because disc is Very Very Slow compared to RAM it is beneficial
>to keep as much in RAM as possible.
>
>Generally the data in RAM (other than program image) is either "clean"
>buffers or "dirty" buffers. Clean buffers are copies of data from
>disc that are known to match the disc. They are immediately available
>should any program was to read that data again instead of having to go
>to disc. Dirty buffers are data written by programs that have not yet
>been written to the disc; the are held in RAM and the program that wrote
>them is free to do more stuff. The OS will write them to disc "soon",
>and as they're written to disc they become "clean" buffers. Either way,
>this data is in RAM where it's immediately accessible.
>
>Eventually your RAM will fill. Until then, the OS will simply use it up
>as I/O happens, accruing cached data. This is "free" - it costs nothing
>to have RAM used up with "clean" buffers because, should more RAM really
>be needed (eg for new "dirty" buffers, or to hold new data read from
>disc), the unwanted clean buffers may simply be discarded instantly -
>the disc copy is good, and will be used another time if needed.
>
>So don't worry about it - it's normal.
>  
>
Thanks Cameron, very helpful.

I was having sudden (maybe will again) problems with my RAM starved 
system until I gave it more RAM; I went from 128M to 1Gig+128M. When I 
was skating by with 128M, the free RAM got to be very low and programs 
as varied as squid, fetchmail and telnet would no longer function. This 
never seemed to be a problem until what seemed like "all of a sudden." 
I'm now working with a theory that the problem is (was?) due to 
incorrectly installing/compiling some programs (BDB without a the 
patches maybe.) We'll see in a week or so when my free RAM gets to some 
low point.

Cheers,


Bill





More information about the redhat-list mailing list