Subject: Re: free()
To: Kevin P. Neal <>
From: John Franklin <>
List: netbsd-users
Date: 02/19/2001 10:06:23
On Mon, Feb 19, 2001 at 01:29:35AM -0500, Kevin P. Neal wrote:
> Calls to malloc() will increase the break size (or mmap /dev/null or
> similar) by doing system calls. Since system calls are expensive, free()
> doesn't return memory to the kernel because often it will just be 
> malloc()'d again. This is an optimization for time at the expense of
> space.

After using X11 all day (with things like xplanet and xscreensaver running
occasionally), I notice that my swap usage goes waaaay up.  More than 
I can account for through top.

When I kill the X server via ctl-alt-backspace, it frees up a larger chunk
of swap than top claimed X was using.  Is this a side effect of the 
malloc() optimization, or is this indicitive of a larger bug?

John Franklin
ICBM: 3548'19"N 7846'39"W