views:

364

answers:

3

Firefox 3 came with a new allocator: jemalloc

I have heard at several places that this new allocator is better. The top Google results don't gave any further information though and I am interested in how exactly it works.

+2  A: 

There is one intersting source: the C-source itself:
http://mxr.mozilla.org/mozilla-central/source/memory/jemalloc/jemalloc.c

In the beginning, a short summary describes how it works roughly. Though, a more depth algorithm analysis is missing.

Albert
+6  A: 

jemalloc first appeared for FreeBSD, the brainchild of one "Jason Evans", hence the "je".

See this PDF for full details. It's a whitepaper describing in detail how the algorithms work and, by the way, was the top result in Google for "jemalloc" so I'm not sure how you failed to find it :-)

The main benefit is scalability in multi-processor and multi-threaded systems achieved, in part, by using multiple arenas. And it seems to have similar performance to current best algorithms for single threaded use.

But, I'm sure you bods can read as well as I can. Go check out the whitepaper.

paxdiablo
Seems I really have overseen the first result. :P But thanks a lot for the hint.
Albert
+3  A: 

As for what benefits jemalloc brought to mozilla, per http://blog.pavlov.net/2008/03/11/firefox-3-memory-usage/ (also first google result for mozilla+jemalloc):

[...]concluded that jemalloc gave us the smallest amount of fragmentation after running for a long period of time. [...] Our automated tests on Windows Vista showed a 22% drop in memory usage when we turned jemalloc on.

Nickolay