Possible memory leak?

Oliver Fromme olli at lurza.secnetix.de
Tue Mar 20 09:44:15 UTC 2007


Stefan Ehmann wrote:
 > Sometimes I'm noticing very high memory usage. Nearly my whole memory (1GB) is 
 > used although I'm running my usual set of processes - normally memory usage 
 > is much lower.

That's normal.  FreeBSD uses nearly all free memory for
buffer cache and other kinds of caches.

 > I killed most processes but memory usage remains high.

How do you measure "memory usage"?  The numbers from top(1)
are mostly meaningless.  Personally I think top should be
removed from FreeBSD, because it confuses many people (in
fact I think _most_ people don't interpret the numbers
correctly), but some people seem to be in love with it. :-)

 > Summing the VSZ values of the ps aux output gives about 34MB. top reports 
 > 316MB active memory.

While summing the VSZ values doesn't make any sense, that
number doesn't sound worrying.

 > dmesg/ps/top output can be found here:
 > http://stud4.tuwien.ac.at/~e0125637/fbsd/

It all looks perfectly normal to me.

If you need to find out whether you're running short of
RAM, use "vmstat 5" and watch it for a while (ignore the
first line because it contains only averages since reboot).
If the "po" (page-out) and "sr" (scan rate, which is an
indication of memory pressure) values are constantly very
high, then you either need more RAM, or you have a memory
leak somewhere.  In all other cases (i.e. po and sr are
zero most of the time), there's nothing to worry about.
Note that the "pi" value is not important, because page-
ins happen normally when reading executables, libraries
or memory-mapped files.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"... there are two ways of constructing a software design:  One way
is to make it so simple that there are _obviously_ no deficiencies and
the other way is to make it so complicated that there are no _obvious_
deficiencies."        -- C.A.R. Hoare, ACM Turing Award Lecture, 1980


More information about the freebsd-stable mailing list