13 ms·
Meta’s renewed commitment to jemalloc
https://github.com/jemalloc/jemalloc https://github.com/jemalloc/jemalloc
- fermentation 7mo agoSeems like they’d want to wait to commit until after the layoffs, right?
- OsrsNeedsf2P 7mo agoI work in the space. This article would not have been published if the team responsible was on the chopping block
- VoidWarranty 7mo ago[dead]
- kubb 7mo agoIt's just one team with like 4 people. They can layoff a lot of staff from Metaverse.
- thatoneengineer 7mo agoFirst 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!
- MBCook 7mo agoIt’s still quite corporate-y, but other than the way of writing I agree it’s generally quite clear.
- rgupta1833 7mo ago[dead]
- oncallthrow 7mo agoAnd the Oscar for most mealy-mouthed post of the year goes to…
- dang 7mo agoWe 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&sort=byDate&type=comment&query=corporate%20press%20release%20by:dang https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor...
- deleted 7mo ago[deleted]
- bmenrigh 7mo agoI 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.
- sylware 7mo agoIf 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 7mo agoYou are not wrong and this is indeed what zig is trying to push by making all std functions that allocate take a allocator parameter.
- codexon 7mo agoAgreed mostly. Going from standard library to something like jemalloc or tcmalloc will give you around 5-10% wins which can be significant, but the difference between those generic allocators seem small. I just made a slab allocator recently for a custom data type and got speedups of 100% over malloc.
- sylware 7mo agoHere you go.
- adgjlsfhk1 7mo agoOne 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.
- dang 7mo agoRelated. Others? Jemalloc Postmortem - https://news.ycombinator.com/item?id=44264958 https://news.ycombinator.com/item?id=44264958 - June 2025 (233 comments) Jemalloc Repositories Are Archived - https://news.ycombinator.com/item?id=44161128 https://news.ycombinator.com/item?id=44161128 - June 2025 (7 comments)
- markstos 7mo agoHow is the original author making out in the new arrangement?
- deleted 7mo ago[deleted]
- Aurornis 7mo agoJason Evans worked for Facebook for almost two decades, starting in 2009 - https://jasone.github.io/2025/06/12/jemalloc-postmortem/ https://jasone.github.io/2025/06/12/jemalloc-postmortem/ He's doing just fine. If you're looking for a story about a FAANG company not paying engineers well for their work, this isn't it.
- bfgeek 7mo agoOne 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").
- augusto-moura 7mo agoNot 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
- runevault 7mo agoOn 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.
- bluGill 7mo agoFacebook had talks already years ago (10+) - nobody was allowed to share real numbers, but several facebook employed where allowed to share that the company has measured savings from optimizations. Reading between the lines, a 0.1% efficiency improvement to some parts of Facebook would save them $100,000 a month (again real numbers were never publicly shared so there is a range - it can't be less than $20,000), and so they had teams of people whose job it was to find those improvements. Most of the savings seemed to come from HVAC costs, followed by buying less computers and in turn less data centers. I'm sure these days saving memory is also a big deal but it doesn't seem to have been then. The above was already the case 10 years ago, so LLMs are at most another factor added on.
- charcircuit 7mo agoMeta never abandoned jemalloc. https://github.com/facebook/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 7mo agoThe repo's availability isn't related to whether it's still maintained.
- charcircuit 7mo agoMeta 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 7mo agoI'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 7mo agoThe team probably sync'd the two after unarchiving the original.
- Xylakant 7mo agoThis looks a lot as if the facebook/jemalloc repo inserted a single commit 70 commits ago and then rebased the changes in the original repo on top. Because the commit SHAs for the changes pulled in change you see this result.
- nubinetwork 7mo agoSomeone should tell Bryan Cantrill, he'd probably be ecstatic...
- RegnisGnaw 7mo agoIs there a concise timelime/history of this? I thought jemalloc was 100% open source, why is Meta in control of it?
- masklinn 7mo agoJason Evans (the creator of jemalloc) recounted the entire thing last year: https://jasone.github.io/2025/06/12/jemalloc-postmortem/ https://jasone.github.io/2025/06/12/jemalloc-postmortem/
- vintermann 7mo 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 7mo agoRefactor 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.
- rvz 7mo ago> Facebook's coding AIs to the rescue, maybe? I wonder how good all these "agentic" AIs are at dreaded refactoring jobs like these. No. This is something you shouldn't allow coding agents anywhere near, unless you have expert-level understanding required to maintain the project like the previous authors have done without an AI for years.
- kenferry 7mo agoHm, I wonder. I've done some work in this sort of area before, though not literally on a malloc. Yes you very much want to be careful, but ultimately it's the tests that give you confidence. Pound the heck out of it in multithreaded contexts and test for consistency.
- flykespice 7mo agoJemalloc also is used by android bionic libc library
- tonfa 7mo agoDoesn't it depend on vendors/customization? Default is https://llvm.org/docs/ScudoHardenedAllocator.html https://llvm.org/docs/ScudoHardenedAllocator.html since Android 11 (2020).
- flykespice 7mo agoI don't know, that is probably the case I guess? I was recently debugging an app double-free segfault on my android 13 samsung galaxy A51 phone, and the internal stack trace pointed to jemalloc function calls (je_free).
- larsberg 7mo agoscudo has been the default allocator for Android since Android 11, and we are hoping to make it mandatory for the few remaining places that don't use it. Using an allocator without memory protections in 2026 (especially after we have closed nearly all known performance gaps with jemalloc) is really not a great choice.
- xxs 7mo agoFew 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.
- lesscraft 7mo ago[dead]
- deleted 7mo ago[deleted]
- pram 7mo agoI used jemalloc recently for ComfyUI/Wan and it’s literally magic. I’m surprised it doesn’t come that way by default.
- jeffbee 7mo agoAllocators like that aren't the default for every process because they have higher startup costs. They are targeted to server workloads where startup cost doesn't matter, but it matters a lot if you're doing crud like starting millions of short-lived processes.
- senderista 7mo agoI don't think glibc malloc makes an optimal set of tradeoffs for any scenario.
- starkparker 7mo ago(wrong thread)
- gcr 7mo agoThe URL of this story seems to have changed to a Meta press release. What are you quoting?
- deleted 7mo ago[deleted]
- starkparker 7mo agoSorry, misdirected the reply.
- jjuliano 7mo agoI remember I was a senior lead softeng of a worldbank funded startup project, and have deployed Ruby with jemalloc in prod. There's a huge noticeable speed and memory efficiency. It did saved us a lot of AWS costs, compare to just using normal Ruby. This was 8 years ago, why haven't projects adopt it yet as de facto.
- kortex 7mo agoUsually lack of knowledge that such a thing exists, or just plain ol' momentum. Changing something long in production at established companies, even if there is a tangible benefit, can be a real challenge.
- lobf 7mo ago>We are committed to continuing to develop jemalloc development From the Department of Redundancy Department.
- adsharma 7mo ago> We plan to deliver improvements to [..] purging mechanisms During my time at Facebook, I maintained a bunch of kernel patches to improve jemalloc purging mechanisms. It wasn't popular in the kernel or the security community, but it was more efficient on benchmarks for sure. Many programs run multiple threads, allocate in one and free in the other. Jemalloc's primary mechanism used to be: madvise the page back to the kernel and then have it allocate it in another thread's pool. One problem: this involves zero'ing memory, which has an impact on cache locality and over all app performance. It's completely unnecessary if the page is being recirculated within the same security domain. The problem was getting everyone to agree on what that security domain is, even if the mechanism was opt-in. https://marc.info/?l=linux-kernel&m=132691299630179&w=2 https://marc.info/?l=linux-kernel&m=132691299630179&w=2
- jcalvinowens 7mo agoI'm really surprised to see you still hocking this. We did extensive benchmarking of HHVM with and without your patches, and they were proven to make no statistically significant difference in high level metrics. So we dropped them out of the kernel, and they never went back in. I don't doubt for a second you can come up with specific counterexamples and microbenchnarks which show benefit. But you were unable to show an advantage at the system level when challenged on it, and that's what matters.
- adsharma 7mo agoYou probably weren't there when servers were running for many days at a time. By the time you joined and benchmarked these systems, the continuous rolling deployment had taken over. If you're restarting the server every few hours, of course the memory fragmentation isn't much of an issue. > But you were unable to show an advantage at the system level when challenged on it, and that's what matters. You mean 5 years after I stopped working on the kernel and the underlying system had changed? I don't recall ever talking to you on the matter.
- jcalvinowens 7mo ago
- joelsiks 7mo agoOpening up strong with a gigantic merge of the stuff they've been working on in their own fork: https://github.com/jemalloc/jemalloc/pull/2863 https://github.com/jemalloc/jemalloc/pull/2863
- rishabhjajoriya 7mo agoLarge engineering orgs often underestimate how much CI pipelines amplify performance issues. Even small inefficiencies multiply when builds run hundreds of times a day.
- jshorty 7mo agoSurprised not to see any mention of the global memory supply shock. Would love to learn more about how that economic is shifting software priorities toward memory allocation for the first time in my (relatively young) career
- deleted 7mo ago[deleted]
- twodave 7mo agoWhile it may seem directly related, it's just not. These things are worked on regardless of how cheap or expensive RAM is, because optimizing memory footprint pretty much always leads to fewer machines leased, which is a worthwhile goal even for smaller shops.
- jshorty 7mo agoThat's useful to know, thank you.
- refulgentis 7mo agoThere’s been shocks at hyperscaler scale, ex. this got yuge at Google for a couple years before ChatGPT
- m3kw9 7mo agoAll the AI investment and their biggest news is commitment to Jemalloc
- celdon25 7mo ago> Building a software system is a lot like building a skyscraper: The product everyone sees is the top, but the part that keeps it from falling over is the foundation buried in the dirt and the scaffolding hidden from sight. They should have just called it an ivory tower, as that's what they're building whenever they're not busy destroying democracy with OS Backdoor lobbyism or Cambridge Analytica shenanigans. Edit: If every thread about any of Elon Musk's companies can contain at least 10 comments talking about Elon's purported crimes against humanity, threads about Zuckerberg's companies can contain at least 1 comment. Without reminders like this, stories like last week's might as well remain non-consequential.
- carlos256 7mo agoIf you need to optimize the allocator you are doing it wrong.
- cbarrick 7mo agoExactly. No need to engineer an allocator. You only live once! void* malloc(size_t size) { void *ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); return (ptr == MAP_FAILED) ? NULL : ptr; } void free(void *ptr) { /* YOLO */ } /s
- ot 7mo agoThat's a false dichotomy: you optimize both the application and the allocator. A 0.5% improvement may not be a lot to you, but at hyperscaler scale it's well worth staffing a team to work on it, with the added benefit of having people on hand that can investigate subtle bugs and pathological perf behaviors.
- sumtechguy 7mo agoexactly. I can think of at least 5 different projects I have been on where a better allocator would made a world of difference. I can also think of another 5 where it probably would have been a waste of time to even fiddle with. but as usual there is an xkcd for that. https://xkcd.com/1205/ https://xkcd.com/1205/ One project I spent a bunch of time optimizing the write path of I/O. It was just using standard fwrite. But by staging items correctly it was an easy 10x speed win. Those optimizations sometimes stack up and count big. But it also had a few edges on it, so use with care.
- saagarjha 7mo agoGlad we have super slow allocators then
- apatheticonion 7mo agoAs an Australian who was just made redundant from a role that involved this type of low level programming - I love working on these these kinds of challenges. I'm saddened that the job market in Australia is largely React CRUD applications and that it's unlikely I will find a role that lets me leverage my niche skill set (which is also my hobby)
- ajxs 7mo agoSpeaking as an Australian that works on React CRUD applications because there's nothing else in the market, I've been reading through this thread thinking the exact same thing.
- apatheticonion 7mo agoGoogle had some position open working on the kernel for ChromeOS, and Microsoft had some positions working on data center network drivers. I applied for both and got ghosted, haha. I also saw a government role as a security researcher. Involves reverse engineering, ghidra and that sort of thing. Super awesome - but the pay is extremely uncompetitive. Such a shame. Other than that, the most interesting roles are in finance (like HFT) - where you need to juggle memory allocations, threads and use C++ (hoping I can pitch Rust but unlikely). Sadly they have a reputation of having pretty rough cultures, uncompetitive salaries and it's all in-office
- deleted 7mo ago[deleted]
- Pepe1vo 7mo agoNot sure if it's the domain you're interested in, but there are quite a few HFT firms with offices in Australia. The one I know of (IMC trading) does a lot of low level stuff like this and is currently hiring.
- apatheticonion 7mo agoI'm actually looking at HFT companies. Hoping I find one that allows remote working - but looks like there are basically no remote roles going at the moment
- Sarkie 7mo agoI nice use case too https://technology.blog.gov.uk/2015/12/11/using-jemalloc-to-get-to-the-bottom-of-a-memory-leak/ https://technology.blog.gov.uk/2015/12/11/using-jemalloc-to-...
- openclaw01 7mo ago[dead]
- rwaksmunski 7mo agojemalloc 5.2.1 vs mimalloc v3.2.8 in Rust software processing hundreds of Terabytes. Could not measure a meaningful difference, but mimalloc would release freed memory to the OS a lot sooner and therefore look nicer in top. That said, older mimalloc from default rust crate would cause memory corruption with large allocations >2Gb in about 5% of the cases. Stuck with battle hardened jemalloc for now.
- torginus 7mo agoMimalloc my beloved. The fact that jemalloc is this fiendishly complex allocator with a gazillion algorithms and approaches ( and a huge binary), yet mimalloc (a simple allocator with one bitmap-tracked pool per allocation size, and one pool collection per thread) is one of the bigger wins in software simplicity in recent memory.
- wengo314 7mo agojemalloc saved my icinga2 installation that kept exploding in memory usage, when i (and agents from sub-zones) was hammering its api when i preloaded jemalloc , memory remained at significantly lower levels, and - more importantly - it was stable. there seems to be no single correct solution to memory allocation, depending on the workload
- genie3io 7mo ago[dead]
- agnishom 7mo agoGlad to see the commitment towards important non-LLM projects!
- robertlagrant 7mo ago> With the leverage jemalloc provides however, it can be tempting to realize some short-term benefit. It requires strong self-discipline as an organization to resist that temptation and adhere to the core engineering principles. This doesn't quite read properly to me. What does it actually mean, does anyone know?
- gjm11 7mo agoI'm pretty sure it means something like this: "Because jemalloc is used all over the place in our systems that run at tremendous scale, some hack that improves its performance a little bit while degrading the longer-term maintainability of the code can look very appealing -- look, doing this thing will save us $X,000,000 per year! -- and it takes discipline to avoid giving in to that temptation and to insist on doing things properly even if sometimes it means passing up a chance to make the code 0.1% faster and 10% messier."
- throwaway2046 7mo agohttps://archive.ph/CFQBU https://archive.ph/CFQBU
- mywacaday 7mo agoThe only option for cookies is to accept these terms and conditions, I thought implied consent was explicitly not allowed due to GDPR? "To help personalize content, tailor and measure ads and provide a safer experience, we use cookies. By clicking or navigating the site, you agree to allow our collection of information on and off Facebook through cookies. Learn more, including about available controls: https://engineering.fb.com/privacy https://engineering.fb.com/privacy"
- flippyhead 7mo agoJemalloc and Jalad at Tanagra!
- fhn 7mo agothis is just meta wanting people to test and fix. they don't care about it but they want you to
- robutsume 7mo ago[dead]
- openinstaclaw 7mo ago[dead]
- unit149 7mo ago[dead]
- Asm2D 7mo agoIt would be great if Meta was able to sustain to support more open source projects, especially those they benefit from. For example they use AsmJit in a lot of projects (both internal and open-source) and it's now unmaintained because of funding issues. Maybe they have now internal forks too.