Subject: Re: Importing jemalloc
To: Andrew Doran <ad@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 01/21/2007 10:23:34
On Sun, Jan 21, 2007 at 05:09:03AM +0000, Andrew Doran wrote:
> Hi,
>
> I ported FreeBSD's new malloc code (jemalloc) to NetBSD's libc. The main
> advantage this brings is significantly reduced contention for multi-threaded
> programs that use malloc heavily.
>
> For single threaded programs, it seems that jemalloc might have lower or
> comparable CPU and memory footprints when compared against phkmalloc. There
> is a paper at the URL below. If you go up a directory or two, there are more
> interesting files.
>
> http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf
I surprised they are using a 'binary buddy' scheme, they tend to be a
recusive PITA for MP systems.
Also that document doesn't describe the problem of data allocated by one
thread, but freed by another. Which requires you acquire the correct
lock for the arena into which the data will be freed.
David
--
David Laight: david@l8s.co.uk