jemalloc for small applications

Konstantin Tokarev annulen at
Tue May 27 00:32:34 PDT 2014

27.05.2014, 11:15, "Eric Wong" <normalperson at>:
> Hello, I've been using jemalloc 3.6 more on my 64-bit Debian stable
> workstations and notice it uses more memory than eglibc malloc for my
> smaller Ruby daemons.
> For example, dtas-player[1] uses 4-5M more memory with jemalloc when
> running on recent ruby-trunk (r46150).  (./configure LIBS=-ljemalloc)
> Everything is mostly single-threaded and contention is not an issue, so
> I use MALLOC_CONF=narenas:1 for jemalloc and MALLOC_ARENA_TEST=1
> MALLOC_ARENA_MAX=1 for eglibc.
> Is higher memory usage for small apps is inherent in the design and a
> concious tradeoff for bigger apps?
> Are there tuning or (preferably) out-of-the-box changes which can be
> made to reduce memory usage for smaller apps?
> But probably most development is driven by users of large server
> applications and not crazy music shells like dtas :)
> Anyways, my fat Ruby web server is happier on jemalloc :)
> 60-80M on eglibc, ~40M on jemalloc (32-bit on a VM, even))
> Thanks for jemalloc and for reading!
> [1]

You may want to decerease lg_chunk value, e.g. MALLOC_CONF=lg_chunk:21.

Note that it degrades performance of allocator, it may even become slower
than glibc at some point.

Regards, Konstantin

More information about the jemalloc-discuss mailing list