Software Development with Linux

What is jemalloc

WED, 25 FEB 2015

jemalloc is an alternative malloc(3) implementation. That is, you can use it instead of the default glibc malloc(3) implementation. It is really easy to use; simply LD_PRELOAD the libjemalloc.so shared library file and you're done. But the question is: why would you want to change the memory allocator of your application?

There's multiple answers to that, including :

- jemalloc result in less memory fragmentation

- jemalloc return freed memory to the operation system (especially useful when no swap partition)

- jemalloc include memory profiling capabilities

- jemalloc include memory debugging capabilities

- jemalloc offer better performances for multithreaded applications

And do not fear to be alone, plenty of projects are using it.

So have a look at jemalloc, and I recommend you benchmark your application using this memory allocator. Nothing to lose, but you could improve the performances of your application with no much effort. What is not to like?