unsatisfying c++/boost::multi_index_container::erase performance on at least FreeBSD 6.0

Jason Evans jasone at FreeBSD.org
Fri Mar 17 08:14:32 UTC 2006


bert hubert wrote:
> Thanks Jason, this has helped narrow down the problem significantly. From
> this I understand that to work around this problem, I have some options:
> 
> 1) tweak my code to not allocate such a large amount of small objects
> 2) move away from malloc/free based c++ allocators
> 3) recompile libc with jemalloc
> 
> I'm really hoping for 4) where I can LD_PRELOAD only jemalloc, would that
> be possible? Or does libc include parts of malloc/free itself inlined?
> 
> I'd hate to force PowerDNS users to recompile their libc for me :-)

Yes, you should be able to use LD_PRELOAD to pre-load a shared library 
that has nothing but malloc.o in it.  In order to build jemalloc on 6.x, 
you will also need sys/tree.h from -current.

If you are using pthreads on an SMP system, you will either need to 
increase the number of libc spinlocks in libpthread, or use 
MALLOC_OPTIONS to make sure that a small enough number of arenas is used.

Jason


More information about the freebsd-hackers mailing list