jemalloc Suitable for embedded environments

Jason Evans jasone at
Thu May 7 19:08:29 PDT 2015

On May 7, 2015, at 4:01 PM, Mayank Kumar (mayankum) <mayankum at> wrote:
> --what specifically causes the code size bloat ?

jemalloc implements several features that aren't strictly necessary, which is counter to the nature of highly constrained embedded systems.  Thread caches, extensive statistics collection, heap profiling, etc. all require extra code.  Additionally, the core algorithms are more sophisticated than those of simpler allocators, which also requires extra code.  I just built a dev version of jemalloc on FreeBSD as such:

  $ EXTRA_CFLAGS="-Os" ./ --disable-stats --disable-tcache --disable-fill
  $ gmake
  $ strip -g lib/
  $ ls -l lib/
  -rwxr-xr-x 1 jasone wheel 182856 May  7 19:02 lib/

179 KiB is by no means svelt for a malloc implementation.

> --it is comforting to hear that the jemalloc is already part of FreeBSD. I would like to know which version of jemalloc is part of FreeBSD releases now ? Also does the FreeBSD distribution of jemalloc includes all the enhancements done for Facebook or is it some stripped down version?

IIRC it's somewhere in the 3.5.1-3.6.0 range for FreeBSD 10.  I plan to commit version 4 to FreeBSD-11 CURRENT within the next month or so.


More information about the jemalloc-discuss mailing list