Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2005 00:08:07 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: malloc(9) statistics.
Message-ID:  <20050728000702.E54330@fledge.watson.org>
In-Reply-To: <20050727175158.GP46538@darkness.comp.waw.pl>
References:  <20050727175158.GP46538@darkness.comp.waw.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050728000702.E54330>