From owner-freebsd-current@FreeBSD.ORG Tue Jun 28 17:49:26 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E649716A423 for ; Tue, 28 Jun 2005 17:49:26 +0000 (GMT) (envelope-from gilham@csl.sri.com) Received: from mailgate-internal2.sri.com (mailgate-internal2.SRI.COM [128.18.84.104]) by mx1.FreeBSD.org (Postfix) with SMTP id 7025F43D49 for ; Tue, 28 Jun 2005 17:49:26 +0000 (GMT) (envelope-from gilham@csl.sri.com) Received: from localhost (HELO mailgate-internal2.SRI.COM) (127.0.0.1) by mailgate-internal2.sri.com with SMTP; 28 Jun 2005 17:49:25 -0000 Received: from mx1.csl.sri.com ([130.107.1.29]) by mailgate-internal2.SRI.COM (SMSSMTP 4.0.5.66) with SMTP id M2005062810492521986 for ; Tue, 28 Jun 2005 10:49:25 -0700 Received: from quarter.csl.sri.com (mx0.csl.sri.com [130.107.1.30]) by mx1.csl.sri.com (8.12.11/8.12.11) with ESMTP id j5SHnPMV067771 for ; Tue, 28 Jun 2005 10:49:25 -0700 (PDT) (envelope-from gilham@csl.sri.com) Received: from snapdragon (snapdragon.csl.sri.com [130.107.19.20]) by quarter.csl.sri.com (8.12.9/8.12.10) with ESMTP id j5SHnPlr017616 for ; Tue, 28 Jun 2005 10:49:25 -0700 Message-Id: <200506281749.j5SHnPlr017616@quarter.csl.sri.com> To: freebsd-current@freebsd.org X-Mailer: MH-E 7.82; nmh 1.0.4; GNU Emacs 21.3.1 Date: Tue, 28 Jun 2005 10:49:25 -0700 From: Fred Gilham Subject: Weird problem with devstat interface X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 17:49:27 -0000 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@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.