*BSD News Article 9618


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6112 ; Mon, 04 Jan 93 23:12:00 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!spool.mu.edu!olivea!mintaka.lcs.mit.edu!ai-lab!hal.gnu.ai.mit.edu!mycroft
From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
Newsgroups: comp.unix.bsd
Subject: Re: Memory leak in kvm_getprocs() and top 3.0
Message-ID: <1iglarINN9ou@life.ai.mit.edu>
Date: 7 Jan 93 07:15:39 GMT
References: <1ig4u5INNstu@life.ai.mit.edu>
Organization: /etc/organization
Lines: 24
NNTP-Posting-Host: hal.gnu.ai.mit.edu


Here is a patch, based on my previous diffs, to make the `RSS' field in
top's display actually have some meaning.  The problem was caused by an
odd quirk in the interaction between the kvm functions and the kernel.

-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----
*** top-3.0/m_386bsd.c~	Thu Jan  7 01:51:42 1993
--- top-3.0/m_386bsd.c	Thu Jan  7 02:02:12 1993
***************
*** 383,388 ****
--- 383,389 ----
  		 (PP(pp, p_stat) == SRUN)) &&
  		(!show_uid || EP(pp, e_pcred.p_ruid) == (uid_t)sel->uid))
  	    {
+ 		(void)kvm_getu(pp);
  		*prefp++ = pp;
  		active_procs++;
  	    }
-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----

-- 
 \  /   Charles Hannum, mycroft@ai.mit.edu
 /\ \   PGP public key available on request.  MIME, AMS, NextMail accepted.
Scheme  White heterosexual atheist male (WHAM) pride!