4 ms·
> I’m also weakly curious why jemalloc needs so much locking anyway? I'd love to hear from someone with more firsthand knowledge, but from a quick read of the
by enragedcacti 4y ago
> I’m also weakly curious why jemalloc needs so much locking anyway?
I'd love to hear from someone with more firsthand knowledge, but from a quick read of the implementation details for jemalloc, it seems there is a balance that has to be struck between lock contention and memory fragmentation. Too few arenas and lock contention slows you down, too many arenas (or enabling thread-specific caches) and the cache misses from fragmentation will slow you down.
the blog post also mentioned that Firefox's jemalloc is highly customized, maybe firefox's specific profile gets value out of a more lock-heavy strategy.
https://jemalloc.net/jemalloc.3.html https://jemalloc.net/jemalloc.3.html (see "Implementation Notes")