{"slug": "jemalloc", "name": "jemalloc", "category": "dev-libs", "category_name": "Libraries and frameworks", "description": "A general-purpose malloc implementation focused on fragmentation avoidance and concurrency.", "recommenders": 8, "commenters": 8, "warners": 0, "score": 7.461, "rising": 4.02, "first": "2026-03-16", "latest": "2026-09-18", "why": "Recommended as a drop-in replacement for glibc malloc that sharply cuts memory use in Rails, Sidekiq, Python and JVM services, and valued for per-thread allocation counters.", "why_is_quote": false, "has_verdict": true, "sentiment": {"recommend": 8, "neutral": 0, "compare": 0, "warn": 0}, "spark": [0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 5, 0], "listed": true, "loved": ["Lower memory use", "Fewer OOM kills"], "caveat": "Needs tuning", "short_quote": "Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads.", "icon": false, "domain": null, "github_repo": null, "official_url": "https://jemalloc.net/", "pricing": "open source", "aliases": ["jemalloc"], "verdict": [{"text": "Recommended as a drop-in replacement for glibc malloc that sharply cuts memory use in Rails, Sidekiq, Python and JVM services,", "cites": [{"id": 796135456, "item_id": 49758466, "url": "https://news.ycombinator.com/item?id=49758466", "by": "collimarco", "date": "2026-09-18", "stance": "recommend", "quote": "Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads.", "excerpt": "Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads. We use it for all our Ruby / Rails apps running on Kubernetes / Cuber: https://answers.abstractbrain.com/how-to-enable-jemalloc-for-ruby-docker-image", "context": "runs Rails apps on Kubernetes", "use_case": "Rails memory reduction", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 796050272, "item_id": 49753142, "url": "https://news.ycombinator.com/item?id=49753142", "by": "majora2007", "date": "2026-09-18", "stance": "recommend", "quote": "Switched to jemalloc and instantly memory stayed well below 1GB.", "excerpt": "I'm in the same boat, I just switched to using it for Kavita, which only does some basic open Image -> Thumbnail to smaller size -> write to disk when importing new comics/books and on linux, memory could swell to 10GB and never get released. Switched to jemalloc and instantly memory stayed well below 1GB.", "context": "runs Kavita on Linux", "use_case": "memory allocator for Kavita", "switched_from": "glibc malloc", "story": "Jemalloc 5.4.0"}, {"id": 796032304, "item_id": 49752019, "url": "https://news.ycombinator.com/item?id=49752019", "by": "albertgoeswoof", "date": "2026-09-18", "stance": "recommend", "quote": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib", "excerpt": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib There\u2019s a slow memory leak somewhere in my code but with jemalloc it no longer actually matters. Thanks to jemalloc team for this!", "context": "", "use_case": "reducing memory in Sidekiq", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 758543312, "item_id": 47408957, "url": "https://news.ycombinator.com/item?id=47408957", "by": "openclaw01", "date": "2026-03-16", "stance": "recommend", "quote": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.", "excerpt": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services. One thing that wasn't obvious at first was the impact of oversize_threshold on containerized workloads - we had to tune it carefully to avoid OOM kills. Has anyone benchmarked jemalloc vs mimalloc for long-running services?", "context": "runs containerized Python services", "use_case": "memory allocator for Python services", "switched_from": "glibc malloc", "story": "Jemalloc un-abandoned by Meta"}, {"id": 758456496, "item_id": 47403531, "url": "https://news.ycombinator.com/item?id=47403531", "by": "xxs", "date": "2026-03-16", "stance": "recommend", "quote": "some of the services switched to jemalloc for the Java VM.", "excerpt": "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.", "context": "", "use_case": "fixing JVM OOM kills", "switched_from": "", "story": "Jemalloc un-abandoned by Meta"}]}, {"text": " and valued for per-thread allocation counters.", "cites": [{"id": 796091344, "item_id": 49755709, "url": "https://news.ycombinator.com/item?id=49755709", "by": "atombender", "date": "2026-09-18", "stance": "recommend", "quote": "I use Jemalloc on a project because it has per-thread allocation counters.", "excerpt": "I use Jemalloc on a project because it has per-thread allocation counters. This lets me not only track what each thread is using, but also restrict workloads by enforcing a memory budget. Since my application is almost completely CPU-bound, I allocate one thread per core and then have some smart scheduling to route requests to the threads. I looked at tcmalloc and mimalloc, and neither had this feature at the time, n", "context": "", "use_case": "per-thread memory budgeting", "switched_from": "", "story": "Jemalloc 5.4.0"}]}, {"text": " The main caveat is that it can need tuning, such as oversize_threshold in containers to avoid OOM kills.", "cites": [{"id": 758543312, "item_id": 47408957, "url": "https://news.ycombinator.com/item?id=47408957", "by": "openclaw01", "date": "2026-03-16", "stance": "recommend", "quote": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.", "excerpt": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services. One thing that wasn't obvious at first was the impact of oversize_threshold on containerized workloads - we had to tune it carefully to avoid OOM kills. Has anyone benchmarked jemalloc vs mimalloc for long-running services?", "context": "runs containerized Python services", "use_case": "memory allocator for Python services", "switched_from": "glibc malloc", "story": "Jemalloc un-abandoned by Meta"}]}], "praise": [{"label": "Lower memory use", "summary": "Switching from the default allocator cut memory dramatically, in some cases from 8\u201310GB to under 1GB.", "quotes": [{"id": 796032304, "item_id": 49752019, "url": "https://news.ycombinator.com/item?id=49752019", "by": "albertgoeswoof", "date": "2026-09-18", "stance": "recommend", "quote": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib", "excerpt": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib There\u2019s a slow memory leak somewhere in my code but with jemalloc it no longer actually matters. Thanks to jemalloc team for this!", "context": "", "use_case": "reducing memory in Sidekiq", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 796050272, "item_id": 49753142, "url": "https://news.ycombinator.com/item?id=49753142", "by": "majora2007", "date": "2026-09-18", "stance": "recommend", "quote": "Switched to jemalloc and instantly memory stayed well below 1GB.", "excerpt": "I'm in the same boat, I just switched to using it for Kavita, which only does some basic open Image -> Thumbnail to smaller size -> write to disk when importing new comics/books and on linux, memory could swell to 10GB and never get released. Switched to jemalloc and instantly memory stayed well below 1GB.", "context": "runs Kavita on Linux", "use_case": "memory allocator for Kavita", "switched_from": "glibc malloc", "story": "Jemalloc 5.4.0"}, {"id": 758543312, "item_id": 47408957, "url": "https://news.ycombinator.com/item?id=47408957", "by": "openclaw01", "date": "2026-03-16", "stance": "recommend", "quote": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.", "excerpt": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services. One thing that wasn't obvious at first was the impact of oversize_threshold on containerized workloads - we had to tune it carefully to avoid OOM kills. Has anyone benchmarked jemalloc vs mimalloc for long-running services?", "context": "runs containerized Python services", "use_case": "memory allocator for Python services", "switched_from": "glibc malloc", "story": "Jemalloc un-abandoned by Meta"}]}, {"label": "Fewer OOM kills", "summary": "Switching made out-of-memory kills and unreleased memory problems go away.", "quotes": [{"id": 758456496, "item_id": 47403531, "url": "https://news.ycombinator.com/item?id=47403531", "by": "xxs", "date": "2026-03-16", "stance": "recommend", "quote": "some of the services switched to jemalloc for the Java VM.", "excerpt": "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.", "context": "", "use_case": "fixing JVM OOM kills", "switched_from": "", "story": "Jemalloc un-abandoned by Meta"}, {"id": 796050272, "item_id": 49753142, "url": "https://news.ycombinator.com/item?id=49753142", "by": "majora2007", "date": "2026-09-18", "stance": "recommend", "quote": "Switched to jemalloc and instantly memory stayed well below 1GB.", "excerpt": "I'm in the same boat, I just switched to using it for Kavita, which only does some basic open Image -> Thumbnail to smaller size -> write to disk when importing new comics/books and on linux, memory could swell to 10GB and never get released. Switched to jemalloc and instantly memory stayed well below 1GB.", "context": "runs Kavita on Linux", "use_case": "memory allocator for Kavita", "switched_from": "glibc malloc", "story": "Jemalloc 5.4.0"}]}, {"label": "Runtime performance", "summary": "A good malloc can improve a JVM's CPU and memory performance noticeably.", "quotes": [{"id": 796022736, "item_id": 49751421, "url": "https://news.ycombinator.com/item?id=49751421", "by": "iam-da-author", "date": "2026-09-18", "stance": "recommend", "quote": "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.", "excerpt": "TL;DR: Because the runtime of most GC:d languages uses malloc for its internal data structures. I work for the runtime team of JPG @ Oracle. We use malloc in Hotspot, quite a lot actually! 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. I don't think you need the details, but it's good to be aware that some mallocs are better than othe", "context": "works on JVM runtime team at Oracle", "use_case": "JVM memory allocator", "switched_from": "", "story": "Jemalloc 5.4.0"}]}, {"label": "Per-thread counters", "summary": "Per-thread allocation counters allow tracking and enforcing per-thread memory budgets, unlike tcmalloc or mimalloc at the time.", "quotes": [{"id": 796091344, "item_id": 49755709, "url": "https://news.ycombinator.com/item?id=49755709", "by": "atombender", "date": "2026-09-18", "stance": "recommend", "quote": "I use Jemalloc on a project because it has per-thread allocation counters.", "excerpt": "I use Jemalloc on a project because it has per-thread allocation counters. This lets me not only track what each thread is using, but also restrict workloads by enforcing a memory budget. Since my application is almost completely CPU-bound, I allocate one thread per core and then have some smart scheduling to route requests to the threads. I looked at tcmalloc and mimalloc, and neither had this feature at the time, n", "context": "", "use_case": "per-thread memory budgeting", "switched_from": "", "story": "Jemalloc 5.4.0"}]}], "caveats": [{"label": "Needs tuning", "summary": "oversize_threshold had to be tuned carefully for containerized workloads to avoid OOM kills.", "quotes": [{"id": 758543312, "item_id": 47408957, "url": "https://news.ycombinator.com/item?id=47408957", "by": "openclaw01", "date": "2026-03-16", "stance": "recommend", "quote": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.", "excerpt": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services. One thing that wasn't obvious at first was the impact of oversize_threshold on containerized workloads - we had to tune it carefully to avoid OOM kills. Has anyone benchmarked jemalloc vs mimalloc for long-running services?", "context": "runs containerized Python services", "use_case": "memory allocator for Python services", "switched_from": "glibc malloc", "story": "Jemalloc un-abandoned by Meta"}]}, {"label": "Not default", "summary": "It must be enabled explicitly rather than coming as the default allocator.", "quotes": [{"id": 758463248, "item_id": 47403953, "url": "https://news.ycombinator.com/item?id=47403953", "by": "pram", "date": "2026-03-16", "stance": "recommend", "quote": "I used jemalloc recently for ComfyUI/Wan and it\u2019s literally magic.", "excerpt": "I used jemalloc recently for ComfyUI/Wan and it\u2019s literally magic. I\u2019m surprised it doesn\u2019t come that way by default.", "context": "", "use_case": "memory allocator for ComfyUI", "switched_from": "", "story": "Jemalloc un-abandoned by Meta"}]}], "who": [{"by": "collimarco", "context": "runs Rails apps on Kubernetes", "url": "https://news.ycombinator.com/item?id=49758466", "date": "2026-09-18"}, {"by": "majora2007", "context": "runs Kavita on Linux", "url": "https://news.ycombinator.com/item?id=49753142", "date": "2026-09-18"}, {"by": "iam-da-author", "context": "works on JVM runtime team at Oracle", "url": "https://news.ycombinator.com/item?id=49751421", "date": "2026-09-18"}, {"by": "openclaw01", "context": "runs containerized Python services", "url": "https://news.ycombinator.com/item?id=47408957", "date": "2026-03-16"}], "tags": ["for Rails apps", "for Python services", "for JVM services", "for containerized workloads", "for Linux users"], "use_cases": ["rails memory reduction", "per-thread memory budgeting", "memory allocator for kavita", "reducing memory in sidekiq", "jvm memory allocator", "memory allocator for python services"], "compared": [{"slug": "mimalloc", "name": "mimalloc", "co": 2, "switched_from": 0, "switched_to": 0}], "makers": [], "threads": [{"url": "https://news.ycombinator.com/item?id=49750152", "title": "Jemalloc 5.4.0", "mentions": 5}, {"url": "https://news.ycombinator.com/item?id=47402640", "title": "Jemalloc un-abandoned by Meta", "mentions": 3}], "sentiment_by_month": {"2025-11": {}, "2025-12": {}, "2026-01": {}, "2026-02": {}, "2026-03": {"recommend": 3}, "2026-04": {}, "2026-05": {}, "2026-06": {}, "2026-07": {}, "2026-08": {}, "2026-09": {"recommend": 5}, "2026-10": {}}, "quotes": [{"id": 796135456, "item_id": 49758466, "url": "https://news.ycombinator.com/item?id=49758466", "by": "collimarco", "date": "2026-09-18", "stance": "recommend", "quote": "Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads.", "excerpt": "Jemalloc is great for Ruby on Rails apps, and drastically reduces memory usage for the same workloads. We use it for all our Ruby / Rails apps running on Kubernetes / Cuber: https://answers.abstractbrain.com/how-to-enable-jemalloc-for-ruby-docker-image", "context": "runs Rails apps on Kubernetes", "use_case": "Rails memory reduction", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 796091344, "item_id": 49755709, "url": "https://news.ycombinator.com/item?id=49755709", "by": "atombender", "date": "2026-09-18", "stance": "recommend", "quote": "I use Jemalloc on a project because it has per-thread allocation counters.", "excerpt": "I use Jemalloc on a project because it has per-thread allocation counters. This lets me not only track what each thread is using, but also restrict workloads by enforcing a memory budget. Since my application is almost completely CPU-bound, I allocate one thread per core and then have some smart scheduling to route requests to the threads. I looked at tcmalloc and mimalloc, and neither had this feature at the time, n", "context": "", "use_case": "per-thread memory budgeting", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 796050272, "item_id": 49753142, "url": "https://news.ycombinator.com/item?id=49753142", "by": "majora2007", "date": "2026-09-18", "stance": "recommend", "quote": "Switched to jemalloc and instantly memory stayed well below 1GB.", "excerpt": "I'm in the same boat, I just switched to using it for Kavita, which only does some basic open Image -> Thumbnail to smaller size -> write to disk when importing new comics/books and on linux, memory could swell to 10GB and never get released. Switched to jemalloc and instantly memory stayed well below 1GB.", "context": "runs Kavita on Linux", "use_case": "memory allocator for Kavita", "switched_from": "glibc malloc", "story": "Jemalloc 5.4.0"}, {"id": 796032304, "item_id": 49752019, "url": "https://news.ycombinator.com/item?id=49752019", "by": "albertgoeswoof", "date": "2026-09-18", "stance": "recommend", "quote": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib", "excerpt": "I switched to jemalloc on a sidekiq queue and memory dropped from 8gib to under 1gib There\u2019s a slow memory leak somewhere in my code but with jemalloc it no longer actually matters. Thanks to jemalloc team for this!", "context": "", "use_case": "reducing memory in Sidekiq", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 796022736, "item_id": 49751421, "url": "https://news.ycombinator.com/item?id=49751421", "by": "iam-da-author", "date": "2026-09-18", "stance": "recommend", "quote": "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.", "excerpt": "TL;DR: Because the runtime of most GC:d languages uses malloc for its internal data structures. I work for the runtime team of JPG @ Oracle. We use malloc in Hotspot, quite a lot actually! 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. I don't think you need the details, but it's good to be aware that some mallocs are better than othe", "context": "works on JVM runtime team at Oracle", "use_case": "JVM memory allocator", "switched_from": "", "story": "Jemalloc 5.4.0"}, {"id": 758543312, "item_id": 47408957, "url": "https://news.ycombinator.com/item?id=47408957", "by": "openclaw01", "date": "2026-03-16", "stance": "recommend", "quote": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services.", "excerpt": "We migrated to jemalloc from glibc malloc two years ago and saw 15-20% memory reduction in our Python services. One thing that wasn't obvious at first was the impact of oversize_threshold on containerized workloads - we had to tune it carefully to avoid OOM kills. Has anyone benchmarked jemalloc vs mimalloc for long-running services?", "context": "runs containerized Python services", "use_case": "memory allocator for Python services", "switched_from": "glibc malloc", "story": "Jemalloc un-abandoned by Meta"}, {"id": 758463248, "item_id": 47403953, "url": "https://news.ycombinator.com/item?id=47403953", "by": "pram", "date": "2026-03-16", "stance": "recommend", "quote": "I used jemalloc recently for ComfyUI/Wan and it\u2019s literally magic.", "excerpt": "I used jemalloc recently for ComfyUI/Wan and it\u2019s literally magic. I\u2019m surprised it doesn\u2019t come that way by default.", "context": "", "use_case": "memory allocator for ComfyUI", "switched_from": "", "story": "Jemalloc un-abandoned by Meta"}, {"id": 758456496, "item_id": 47403531, "url": "https://news.ycombinator.com/item?id=47403531", "by": "xxs", "date": "2026-03-16", "stance": "recommend", "quote": "some of the services switched to jemalloc for the Java VM.", "excerpt": "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.", "context": "", "use_case": "fixing JVM OOM kills", "switched_from": "", "story": "Jemalloc un-abandoned by Meta"}]}