Hacker News new | ask | show | jobs
by sergiogdr 634 days ago
> * Add --enable-jemalloc to build with jemalloc memory allocator (since glibc malloc is so poor).

Somebody with the knowledge care to explain?

1 comments

jemalloc is a thread-caching allocator (there are lots of em).

in a multi-threaded environment (basically literally every environment today) multiple threads needing/requesting/expecting allocations will cause lock contention on the data structures that malloc uses to manage memory. thread-caching allocators mitigate the problem by having basically two areas/arenas/places that they allocate from - a local and a global. local means small and local to each thread, and allocations therefrom are fast because they don't require locking. and conversely for global.