jemalloc

A general-purpose malloc implementation focused on fragmentation avoidance and concurrency.

Recommended as a drop-in replacement for glibc malloc that sharply cuts memory use in Rails, Sidekiq, Python and JVM services,12345 and valued for per-thread allocation counters.6 The main caveat is that it can need tuning, such as oversize_threshold in containers to avoid OOM kills.7
The HN verdict, written from 7 cited comments
8recommend
0warn against
Mar 16, 2026first mention
Sep 18, 2026latest mention
Nov 25 – Oct 26
Used forfor Rails appsfor Python servicesfor JVM servicesfor containerized workloadsfor Linux usersrails memory reductionper-thread memory budgeting

Why people recommend it

Lower memory use · 3

Switching from the default allocator cut memory dramatically, in some cases from 8–10GB to under 1GB.

“I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib”

“Switched to jemalloc and instantly memory stayed well below 1GB.”

runs Kavita on Linuxswitched from glibc mallocon “Jemalloc 5.4.0”
Show 1 more

“We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.”

runs containerized Python servicesswitched from glibc mallocon “Jemalloc un-abandoned by Meta”

Fewer OOM kills · 2

Switching made out-of-memory kills and unreleased memory problems go away.

xxsMar 16, 2026recommends

“some of the services switched to jemalloc for the Java VM.”

“Switched to jemalloc and instantly memory stayed well below 1GB.”

runs Kavita on Linuxswitched from glibc mallocon “Jemalloc 5.4.0”

Runtime performance · 1

A good malloc can improve a JVM's CPU and memory performance noticeably.

“Providing your JVM with a good malloc can improve the performance of the runtime, both in terms of CPU and memory, by quite a bit.”

works on JVM runtime team at Oracleon “Jemalloc 5.4.0”

Per-thread counters · 1

Per-thread allocation counters allow tracking and enforcing per-thread memory budgets, unlike tcmalloc or mimalloc at the time.

“I use Jemalloc on a project because it has per-thread allocation counters.”

Caveats and dissent

Needs tuning · 1

oversize_threshold had to be tuned carefully for containerized workloads to avoid OOM kills.

“We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.”

runs containerized Python servicesswitched from glibc mallocon “Jemalloc un-abandoned by Meta”

Not default · 1

It must be enabled explicitly rather than coming as the default allocator.

“I used jemalloc recently for ComfyUI/Wan and it’s literally magic.”

Often compared with

Who recommends it in their own words

All comments 8

“Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads.”

runs Rails apps on Kuberneteson “Jemalloc 5.4.0”

“I use Jemalloc on a project because it has per-thread allocation counters.”

“Switched to jemalloc and instantly memory stayed well below 1GB.”

runs Kavita on Linuxswitched from glibc mallocon “Jemalloc 5.4.0”

“I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib”

“Providing your JVM with a good malloc can improve the performance of the runtime, both in terms of CPU and memory, by quite a bit.”

works on JVM runtime team at Oracleon “Jemalloc 5.4.0”

“We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.”

runs containerized Python servicesswitched from glibc mallocon “Jemalloc un-abandoned by Meta”

“I used jemalloc recently for ComfyUI/Wan and it’s literally magic.”

xxsMar 16, 2026recommends

“some of the services switched to jemalloc for the Java VM.”

Threads where it came up

Data: jemalloc.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.

Keyboard shortcuts
j / kNext / previous item
o or EnterOpen selected item
/Search
g hHome
g tTop
g rRising
g cCategories
tToggle dark mode
?This help