Re: malloc(9) statistics.

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Thu, 28 Jul 2005 00:08:07 +0100 (BST)
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
Received on Wed Jul 27 2005 - 21:06:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:39 UTC