[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: memory leak

On 08:59 24 Apr 2004, Bill McCormick <wpmccormick 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 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.
Cameron Simpson <cs zip com au> DoD#743

I don't waste my money; I invest it in ventures with high negative returns.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]