Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2005 03:21:29 -0500
From:      David Schultz <das@FreeBSD.ORG>
To:        Jason Henson <jason@ec.rr.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: malloc vs ptmalloc2
Message-ID:  <20050213082128.GA68307@VARK.MIT.EDU>
In-Reply-To: <1108277558l.86500l.0l@BARTON>
References:  <1108277558l.86500l.0l@BARTON>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 13, 2005, Jason Henson wrote:
> I saw on a few of the lists here how linux uses ptmalloc2 and it  
> outperforms bsd's malloc.  I tried to do some research into it and  
> found PHK's pdf on it and it seems bsd's malloc was ment to be ok in  
> most every situation. Because of this it shines when primary storage is  
> seriously over committed.
> 
> So here is my question, I use FreeBSD as a desktop and never ever use  
> swap(I just don't stress my system enough?), can I use ptmalloc in  
> stead of malloc?  Like defining SCHED_ULE instead of SCHED_4BSD.  Can  
> the system malloc be switched out?  

With a little bit of work, you should be able to replace
src/lib/libc/stdlib/malloc.c.  ptmalloc is much more heavyweight,
but it would probably do better in cases where you have a large
number of threads doing a massive number of malloc/free operations
on a multiprocessor system.  Other than that, I don't know enough
details about ptmalloc to speculate, except to say that for most
real-world workloads on modern systems, the impact of the malloc
implementation is likely to be negligible.  Of course, test
results would be interesting...



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