From owner-freebsd-current@FreeBSD.ORG Wed Jul 27 23:06:44 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 E2A7C16A41F; Wed, 27 Jul 2005 23:06:44 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 970C543D48; Wed, 27 Jul 2005 23:06:44 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 17BC046B87; Wed, 27 Jul 2005 19:06:44 -0400 (EDT) Date: Thu, 28 Jul 2005 00:08:07 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Pawel Jakub Dawidek In-Reply-To: <20050727175158.GP46538@darkness.comp.waw.pl> Message-ID: <20050728000702.E54330@fledge.watson.org> References: <20050727175158.GP46538@darkness.comp.waw.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org Subject: Re: malloc(9) statistics. 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: Wed, 27 Jul 2005 23:06:45 -0000 On Wed, 27 Jul 2005, Pawel Jakub Dawidek wrote: > I spend few hours today tracking memory leak. At the end I found, that > there were no memory leak actually, but memory statistics are confusing. > > Command 'vmstat -m' shows number of allocations in column named "InUse". > Coulmn name is wrong and confusing. The column only shows how many > allocation were there (successful or not), so when malloc(..., M_NOWAIT) > fails, it increases InUse value, which is never decreased, because there > will be no corresponding free(9). > > I've two proposals: > > 1. Don't increase allocations counter on failure: > > http://people.freebsd.org/~pjd/patches/kern_malloc.c.patch I think this makes more sense, and the problem is due to a mis-understanding of mine regarding how malloc(9) internally accounts for allocations. Feel free to commit, and MFC in short order to RELENG_6. > 2. Change "InUse" name to something else. (1) since InUse is a useful concept. Thanks! Robert N M Watson