Weird problem with devstat interface

From: Fred Gilham <gilham_at_csl.sri.com>
Date: Tue, 28 Jun 2005 10:49:25 -0700
Hello,

There's a program called xsysinfo in the ports collection which
currently seems to be just about the only working system status program
for FreeBSD 5 or 6.  Unfortunately the current version seems to have a
memory leak.  This memory leak isn't related to the program itself but
to the devstat interface.  By this I mean that it's not caused by any
malloc or free that the program's code does.  If you run this program
for a few days it will grow to hundreds of megabytes in size and
eventually exhaust memory.  It does this under FBSD 5 & 6 but not 4
(which of course uses a different interface to the kernel stats).

The program will not do this if you use the -nodisk option telling it
not to track disk statistics, which means that the problem gets narrowed
down to the devstat stuff that is used to keep track of disk transfers.

I have been able to get the program to stop doing this by changing the
calls to

devstat_checkversion()
devstat_getnumdevs()
devstat_getdevs()

so they don't use the kvm interface but the sysctl interface
(i.e. passing NULL instead of a file descriptor to /dev/kvm).


It seems like there's either a bug in the port or some weirdness in the
devstat interface, so I thought I'd post about it to see if anyone knew
what was going on.

-- 
Fred Gilham                                        gilham_at_csl.sri.com
The PTPL (People's Trotskyist Programming League) believes that
hackers are elitist and that all software should be created by the
masses flailing away at millions of keyboards.  I didn't have the
heart to tell them that this has already been tried and the result is
called Linux.
Received on Tue Jun 28 2005 - 15:49:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:37 UTC