Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!agate!asami
From: asami@cs.berkeley.edu (Satoshi ASAMI)
Newsgroups: comp.os.386bsd.apps
Subject: Solved: top-3.2 memory leak (Re: m_*bsd.c for top 3.0?)
Date: 26 Oct 93 23:33:03
Organization: CS Div. - EECS, University of California, Berkeley, CA 94720
Lines: 42
Message-ID: <ASAMI.93Oct26233303@forgery.cs.berkeley.edu>
References: <ASAMI.93Oct22220018@forgery.cs.berkeley.edu>
<2aev8p$2io@isolar.Tujunga.CA.US> <DFR.93Oct25101951@rhino.ioc.co.uk>
NNTP-Posting-Host: forgery.cs.berkeley.edu
In-reply-to: dfr@rhino.ioc.co.uk's message of Mon, 25 Oct 1993 02:19:50 PDT
In article <DFR.93Oct25101951@rhino.ioc.co.uk>
Doug dfr@rhino.ioc.co.uk (Doug Rabson) writes:
* Why doesn't someone link it with the mprof memory profiling and leak
* detection library from freebsd.cdrom.com:/pub/FreeBSD/.../packages. I
* would but I neither have nor use top.
Thanks for the suggestion. I tried it and found that this change to
kvm.c in /usr/src/lib/libutils will fix it:
===<from here>===
--- ./kvm.c.org Sat Jun 12 07:54:53 1993
+++ ./kvm.c Tue Oct 26 05:37:29 1993
@@ -431,8 +431,8 @@
}
copysize = ret;
if (copysize > ocopysize &&
- (kvmprocbase = (struct kinfo_proc
*)malloc(copysize))
-
== NULL) {
+ (kvmprocbase = (struct kinfo_proc *)
+ realloc(kvmprocbase, copysize)) ==
NULL) {
seterr("out of memory");
return (-1);
}
===<to here>===
(note that my newsreader changes tabs to spaces so you might have to
say "patch -l")
I'll send this to FreeBSD's maintainers. I also got a mail saying
that the bug that causes the memory leak (I assume this one) is fixed
in NetBSD.
---
o o Satoshi Asami
Form follows Function. ^
(asami@CS.Berkeley.EDU)
Tel: (510)547-0336 (home) Computer Science Div., Dept. of EECS
(510)642-1845 (office) University of California at Berkeley