kernel leaking memory somewhere

Matthew Dillon dillon at
Wed Dec 16 10:05:59 PST 2009

    You aren't using any swap space, so you probably aren't running out
    of memory.

    Remember that UNIX (BSD, Linux) systems in general use all available
    memory as a disk cache.  That's basically all that is happening here.
    There's really no concept of 'free' memory per-say... the cache and
    free values you see in the vmstat (or systat -vm 1) output are only used
    for short term memory cycling, e.g. when a program runs, eats some
    memory, and then exits.

    For all of these systems paging to swap is governed by the concept
    of memory pressure rather than memory use (since all of memory is 'used'
    one can't go by memory use).  Memory pressure is produced when the
    set of running programs on the system try to use more memory in
    aggregate then is actually available, or at least enough memory that
    the kernel feels it cannot maintain a large enough disk cache.  The
    kernel will then start paging to swap to try to clean up memory use.

    You can force this as a test you can compile up a little program
    called eatmem.c in /usr/src/test/stress/eatmem.c.  This program
    allocates a ton of memory (specified in megabytes on the command line)
    and then touches it in a loop.  You can use it to force the kernel
    to page stuff out :-).  Then kill it and observe how well the system
    recovers.  Be careful that you do not actually run your system out
    of memory + swap space or it will start killing things.


More information about the Kernel mailing list