HN.zip

Jemalloc un-abandoned by Meta

https://github.com/jemalloc/jemalloc

146 points by hahahacorn - 37 comments

37 Comments

bmenrigh [3 hidden]5 mins ago
I recently started using Microsoft's mimalloc (via an LD_PRELOAD) to better use huge (1 GB) pages in a memory intensive program. The performance gains are significant (around 20%). It feels rather strange using an open source MS library for performance on my Linux system.

There needs to be more competition in the malloc space. Between various huge page sizes and transparent huge pages, there are a lot of gains to be had over what you get from a default GNU libc.

pjmlp [3 hidden]5 mins ago
If you go into Dr Dobbs, The C/C++ User's Journal and BYTE digital archives, there will be ads of companies whose product was basically special cased memory allocator.

Even toolchains like Turbo Pascal for MS-DOS, had an API to customise the memory allocator.

The one size fits all was never a solution.

adgjlsfhk1 [3 hidden]5 mins ago
One of the best parts about GC languages is they tend to have much more efficient allocation/freeing because the cost is much more lumped together so it shows up better in a profile.
pjmlp [3 hidden]5 mins ago
Agreed, however there is also a reason why the best ones also pack multiple GC algorithms, like in Java and .NET, because one approach doesn't fit all workloads.
nevdka [3 hidden]5 mins ago
Then there’s perl, which doesn’t free at all.
codexon [3 hidden]5 mins ago
I've been using jemalloc for over 10 years and don't really see a need for it to be updated. It always holds up in benchmarks against any new flavor of the month malloc that comes out.

Last time I checked mimalloc which was admittedly a while ago, probably 5 years, it was noticebly worse and I saw a lot of people on their github issues agreeing with me so I just never looked at it again.

adgjlsfhk1 [3 hidden]5 mins ago
Mimalloc v3 has just come out (about a month ago) and is a significant improvement over both v2 and v1 (what you likely last tested)
hrmtst93837 [3 hidden]5 mins ago
Benchmarks age fast. Treating a ten-year-old allocator as done just because it still wins old tests is tempting fate, since distros, glibc, kernel VM behavior, and high-core alloc patterns keep moving and the failures usually show up as weird regressions in production, not as a clean loss on someone's benchmark chart.
codexon [3 hidden]5 mins ago
It still beat mimalloc when I checked 4-5 years ago.
IshKebab [3 hidden]5 mins ago
I feel like the real thing that needs to change is we need a more expressive allocation interface than just malloc/realloc. I'm sure that memory allocators could do a significantly better job if they had more information about what the program was intending to do.
anthk [3 hidden]5 mins ago
I used mimalloc to run zenlisp under OpenBSD as it would clash with the paranoid malloc of base.
jeffbee [3 hidden]5 mins ago
Just out of curiosity are you getting 1GB huge pages on Xeon or some other platform? I always thought this class of page is the hardest to exploit, considering that the machine only has, if I recall correctly, one TLB slot for those.
bmenrigh [3 hidden]5 mins ago
Modern x86_64 has supported multiple page sizes for a long time. I'm on commodity Zen 5 hardware (9900X) with 128 GiB of RAM. Linux will still use a base page size of 4kb but also supports both 2 MiB and 1 GiB huge pages. You can pass something like `default_hugepagesz=2M hugepagesz=1G hugepages=16` to your kernel on boot to use 2 MiB pages but reserve 16 1 GiB pages for later use.

The nice thing about mimalloc is that there are a ton of configurable knobs available via env vars. I'm able to hand those 16 1 GiB pages to the program at launch via `MIMALLOC_RESERVE_HUGE_OS_PAGES=16`.

EDIT: after re-reading your comment a few times, I apologize if you already knew this (which it sounds like you did).

sylware [3 hidden]5 mins ago
If there is so much performance difference among generic allocators, it means you need semantic optimized allocators (unless performance is actually not that much important in the end).
Cloudef [3 hidden]5 mins ago
You are not wrong and this is indeed what zig is trying to push by making all std functions that allocate take a allocator parameter.
bfgeek [3 hidden]5 mins ago
One has to wonder if this due to the global memory shortage. ("Oh - changing our memory allocator to be more efficient will yield $XXM dollar savings over the next year").
runevault [3 hidden]5 mins ago
On top of cost, they probably cannot get as much memory as they order in a timely fashion so offsetting that with greater efficiency matters right now.
augusto-moura [3 hidden]5 mins ago
Not just shortage, any improvements to LLMs/electricity/servers memory footprint is becoming much more valuable as the time goes. If we can get 10% faster, you can easily get a lead in the LLM race. The incentives to transparently improving performance are tremendous
dang [3 hidden]5 mins ago
Related. Others?

Jemalloc Postmortem - https://news.ycombinator.com/item?id=44264958 - June 2025 (233 comments)

Jemalloc Repositories Are Archived - https://news.ycombinator.com/item?id=44161128 - June 2025 (7 comments)

xxs [3 hidden]5 mins ago
Few months back, some of the services switched to jemalloc for the Java VM. It took months (of memory dumps and tracing sys-calls) to blame the JVM, itself, for getting killed by the oom_killer.

Initially the idea was diagnostics, instead the the problem disappeared on its own.

RegnisGnaw [3 hidden]5 mins ago
Is there a concise timelime/history of this? I thought jemalloc was 100% open source, why is Meta in control of it?
masklinn [3 hidden]5 mins ago
Jason Evans (the creator of jemalloc) recounted the entire thing last year: https://jasone.github.io/2025/06/12/jemalloc-postmortem/
vintermann [3 hidden]5 mins ago
"Were I to reengage, the first step would be at least hundreds of hours of refactoring to pay off accrued technical debt."

Facebook's coding AIs to the rescue, maybe? I wonder how good all these "agentic" AIs are at dreaded refactoring jobs like these.

xxs [3 hidden]5 mins ago
Refactor doesn't mean just artificial puff-up jobs, it's very likely internal changes and reorganization (hence 100s of hours).

There are not many engineers capable of working on memory allocators, so adding more burden by agentic stuff is unlikely to produce anything of value.

echelon [3 hidden]5 mins ago
If you filter the commits to the past five years, four of the top six committers are Meta employees. The other two might be as well, it just doesn't say that on their Github / personal website.
nubinetwork [3 hidden]5 mins ago
Someone should tell Bryan Cantrill, he'd probably be ecstatic...
thatoneengineer [3 hidden]5 mins ago
First impressions: LOL, the blunt commentary in the HN thread title compared to the PR-speak of the fb.com post.

Second thoughts: Actually the fb.com post is more transparent than I'd have predicted. Not bad at all. Of course it helps that they're delivering good news!

markstos [3 hidden]5 mins ago
How is the original author making out in the new arrangement?
flykespice [3 hidden]5 mins ago
Jemalloc is used by android bionic libc library
charcircuit [3 hidden]5 mins ago
Meta never abandoned jemalloc. https://github.com/facebook/jemalloc remained public the entire time. It's my understanding that Jason Evans, the creator of jemalloc, had ownership over the jemalloc/jemalloc repo which is why that one stopped being updated after he left.
kstrauser [3 hidden]5 mins ago
The repo's availability isn't related to whether it's still maintained.
charcircuit [3 hidden]5 mins ago
Meta still maintained it and actively pushed commits to it fixing bugs and adding improvements. From this blog post it sounds like they are increasing investment into it along with resurrecting the original repo. When the repo was archived Meta said that development on jemalloc would be focused towards Meta's own goals and needs as opposed to the larger ecosystem.
kstrauser [3 hidden]5 mins ago
I'm not directly involved enough to dig into the details here, but facebook/jemalloc currently says:

> This branch is 71 commits ahead of and 70 commits behind jemalloc/jemalloc:dev.

It looks like both have been independently updated.

masklinn [3 hidden]5 mins ago
The team probably sync'd the two after unarchiving the original.
fermentation [3 hidden]5 mins ago
Seems like they’d want to wait to commit until after the layoffs, right?
oncallthrow [3 hidden]5 mins ago
And the Oscar for most mealy-mouthed post of the year goes to…
dang [3 hidden]5 mins ago
We generally try to avoid corporate press releases for that reason, but is there a good third-party post to replace it with?

https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor...