---
title: "jemalloc 5.4.0"
slug: jemalloc-5-4-0
url: https://listedarticles.com/articles/jemalloc-5-4-0
canonical_url: https://github.com/jemalloc/jemalloc/releases/tag/5.4.0
content_type: changelog
language: en
published_at: 2026-09-18T09:14:17.659Z
updated_at: 2026-09-18T09:14:17.659Z
authored_by: human
publisher: "jemalloc"
publisher_url: https://github.com/jemalloc/jemalloc
topics: ["Systems Programming", "Performance", "Open Source", "C"]
license: all-rights-reserved
word_count: 762
reading_minutes: 3
citation: "jemalloc. \"jemalloc 5.4.0.\" 18 Sept 2026. https://github.com/jemalloc/jemalloc/releases/tag/5.4.0 (all-rights-reserved)"
# The full text follows. The web page shows an extract and sends readers
# to the source above; quote the citation and link the canonical URL.
---

# jemalloc 5.4.0

> Release notes for jemalloc 5.4.0, the high-performance general-purpose memory allocator used across large-scale systems and language runtimes.

[ jemalloc ](/jemalloc) / **[jemalloc](/jemalloc/jemalloc) ** Public

  * [ Fork 1.6k ](/login?return_to=%2Fjemalloc%2Fjemalloc)
  * [ Star  11.1k ](/login?return_to=%2Fjemalloc%2Fjemalloc)

# 5.4.0

[Latest](/jemalloc/jemalloc/releases/latest)

[Latest](/jemalloc/jemalloc/releases/latest)

Compare

#  Choose a tag to compare 

## Sorry, something went wrong.

Filter 

Loading

## Sorry, something went wrong.

###  Uh oh! 

There was an error while loading. [Please reload this page]().

## No results found

[View all tags](/jemalloc/jemalloc/tags)

[guangli-dai](/guangli-dai) released this  17 Sep 18:31 

· [ 5 commits ](/jemalloc/jemalloc/compare/5.4.0...dev) to dev since this release 

[ 5.4.0  ](/jemalloc/jemalloc/tree/5.4.0)

[ `7a34f18`](/jemalloc/jemalloc/commit/7a34f18502e7b222724097cdcd499b437d189acc)

This release contains over 160 commits, focusing on the technical debts  
cleaning including refactorings, bug fixes, test coverage improvement, and  
option cleanups. The release also includes portability improvements per  
upstream issues report.

New features:

  * Add `EXTENT_ALLOC_FLAG_PINNED` so custom extent-allocation hooks can  
mark non-reclaimable mappings, such as HugeTLB pages, for preferential  
reuse outside the decay and purge pipeline. Add the mallctl interfaces  
`stats.pinned`, `stats.arenas.<i>.pinned`,  
`stats.arenas.<i>.extents.<j>.npinned`,  
`stats.arenas.<i>.extents.<j>.pinned_bytes`, and  
`stats.arenas.<i>.mutexes.extents_pinned.{counter}` to report  
pinned-memory usage and mutex statistics. ([@binliu19](https://github.com/binliu19): [`be2de8c`](https://github.com/jemalloc/jemalloc/commit/be2de8ccd8ba38d687647ed43d75dc0ee5846df7))
  * Allow resuming per-CPU arena selection via `thread.arena`.  
([@Algunenano](https://github.com/Algunenano): [`68c35f6`](https://github.com/jemalloc/jemalloc/commit/68c35f655792f40243ba5f4bc9577e03cc7cc49d))
  * Better align the contents of human-readable and JSON malloc statistics.  
([@spredolac](https://github.com/spredolac): [`68fe1be`](https://github.com/jemalloc/jemalloc/commit/68fe1be1ad3cd8007a9404a199155d16f5835d08), [`30b1a41`](https://github.com/jemalloc/jemalloc/commit/30b1a41042b06980a1bd1dfb5235dc3026e618ae), [`04aad97`](https://github.com/jemalloc/jemalloc/commit/04aad97faafcb4f15125d4fbd6e92f7fd0aec323))
  * Replace the runtime `experimental_infallible_new` option with the  
compile-time `--enable-cxx-infallible-new` option, enabling  
compiler-level optimizations and optimization in move constructors,  
and fix the `new(std::nothrow)` contract ([@spredolac](https://github.com/spredolac): [`160ab9d`](https://github.com/jemalloc/jemalloc/commit/160ab9d7f62aca5a930929899a9b3be0e459fd83), [`fe33667`](https://github.com/jemalloc/jemalloc/commit/fe336672309b724764093bff8253276bd600ce27))

Incompatible changes:

  * Adapt tcache fill and retention targets per bin to demand observed  
between GC events, replacing the fixed refill/flush policy. Remove  
seven legacy non-experimental controls: `lg_tcache_nslots_mul`,  
`tcache_nslots_small_min`, `tcache_nslots_small_max`,  
`tcache_nslots_large`, `tcache_gc_delay_bytes`,  
`lg_tcache_flush_small_div`, and `lg_tcache_flush_large_div`.  
Corresponding `malloc_conf` settings are silently ignored, matching  
`opt.*` mallctls return ENOENT, and `tcache_ncached_max` remains  
supported. ([@spredolac](https://github.com/spredolac): [`d13fe91`](https://github.com/jemalloc/jemalloc/commit/d13fe91afd6f2834fef5f3eb320f5f7fe34de7be))

Bug fixes:

  * Preserve `errno` across `free`, `free_sized`, and `free_aligned_sized`,  
and across `process_madvise`-based page purging. ([@spredolac](https://github.com/spredolac): [`3a77966`](https://github.com/jemalloc/jemalloc/commit/3a77966168b3c48437370e75e33159980e0fac89),  
[`86f0582`](https://github.com/jemalloc/jemalloc/commit/86f058287faae50caeb6d785aaca0dbb1f1e62b2))
  * Fix numeric overflow checks in size classes. ([@spredolac](https://github.com/spredolac): [`6b24522`](https://github.com/jemalloc/jemalloc/commit/6b245225459fd09132c877b83a91725cb56097da))
  * Accept NULL in `free_sized()` and `free_aligned_sized()` (C23  
correctness). ([@bigbruno](https://github.com/bigbruno): [`7ce8b91`](https://github.com/jemalloc/jemalloc/commit/7ce8b9165d342e705b4554dcc991ec0d41ae36f6))
  * Fix TSD lifecycle edge cases by 1) initializing thread-cache bins before  
marking the cache enabled, preventing reentrant bootstrap allocations  
from using uninitialized state, and 2) avoiding TSD recreation for late  
deallocations after thread teardown on generic-TSD platforms.  
([@fzakaria](https://github.com/fzakaria): [`54f22c8`](https://github.com/jemalloc/jemalloc/commit/54f22c83d8f649f5c34d1b4d89050e00c631a32e), [@spredolac](https://github.com/spredolac): [`fb5499a`](https://github.com/jemalloc/jemalloc/commit/fb5499aa9c13aa7c0e11041009ae894c584b64bd))
  * Use `O_CLOEXEC` when opening the THP sysfs file in `init_thp_state`.  
([@ibookstein](https://github.com/ibookstein): [`d070554`](https://github.com/jemalloc/jemalloc/commit/d0705543e0b3733b12e8643a3962b77834b24209))
  * Fix duplicate `opt.stats_print` and `opt.stats_print_opts` fields in  
`malloc_stats_print` output. ([@spredolac](https://github.com/spredolac): [`dfe3a2e`](https://github.com/jemalloc/jemalloc/commit/dfe3a2ed5f668f39474d6e174b0d41db80fa33dc))
  * Fix a potential deadlock during `arena_reset`. ([@guangli-dai](https://github.com/guangli-dai): [`6957341`](https://github.com/jemalloc/jemalloc/commit/6957341f190b8c66a197e181d5f413d4c77526c2))
  * Fix a prof-sampling / guard-page interaction bug in the SAN. ([@gctony](https://github.com/gctony):  
[`e36a0fa`](https://github.com/jemalloc/jemalloc/commit/e36a0fa5bc1e1090362505ac4af4408466ba5163))

Optimizations and refactors:

  * Modularize jemalloc's front end by extracting arena management,  
initialization, fork orchestration, and allocation dispatch from  
`jemalloc.c`; untangle tcache/arena ownership; and consolidate the  
internal header graph to eliminate circular dependencies. ([@spredolac](https://github.com/spredolac):  
[`ba1e2fe`](https://github.com/jemalloc/jemalloc/commit/ba1e2fe4db78911a56d254e1bd69e17233dde61b), [`8874597`](https://github.com/jemalloc/jemalloc/commit/88745978e91d323aa87fdab7e9f33d5bc50bff57), [`9d75722`](https://github.com/jemalloc/jemalloc/commit/9d75722344244dcdb4a29fc1875081b9fcc95f1f), [`de9ad14`](https://github.com/jemalloc/jemalloc/commit/de9ad1450b09a09732195a1e66c0321d8b077d1e), ...)
  * Simplify ctl dispatch by refactoring arena helpers, internalizing an  
implementation-only control, replacing control-flow macros with typed  
helpers, and organizing `ctl.c` by subsystem. ([@spredolac](https://github.com/spredolac): [`9e14346`](https://github.com/jemalloc/jemalloc/commit/9e143468a244465e4b4a3822f4c1d8de42f39335),  
[`901365d`](https://github.com/jemalloc/jemalloc/commit/901365d473f4fe4ac3023946a56973f0753c18a3), [`4e903a0`](https://github.com/jemalloc/jemalloc/commit/4e903a0a32ba278085f5050ee13442b8e4d2e844), [`5bc8d6e`](https://github.com/jemalloc/jemalloc/commit/5bc8d6e9e21dd7369b8f7899680620578977500a))
  * Cap the base-block growth heuristic to avoid virtual-memory exhaustion  
under rare racy conditions. ([@guangli-dai](https://github.com/guangli-dai): [`2f4db8c`](https://github.com/jemalloc/jemalloc/commit/2f4db8cf5dad7f53164bef13a2c5b49e1195d042))
  * Move background-thread lifecycle and state operations into the  
background-thread module, clarifying ownership independently of PAC/HPA  
callers. ([@guangli-dai](https://github.com/guangli-dai): [`f1f0792`](https://github.com/jemalloc/jemalloc/commit/f1f07923707fb98b7bfd5d837c88dfdd385ba8ce))
  * Simplify the page-allocation boundary by replacing PAI vtable dispatch  
with direct PAC/HPA calls, removing the obsolete `pai_t`/`pai.h`  
abstraction, and moving deferred-work and decay orchestration out of the  
arena. ([@guangli-dai](https://github.com/guangli-dai): [`1dfa6f7`](https://github.com/jemalloc/jemalloc/commit/1dfa6f7aa45b66f8922ef03c255ee329ee97fb97), [`8edd101`](https://github.com/jemalloc/jemalloc/commit/8edd1012869b3e6d1810001c22198cc148c5d4f2), [`d410f43`](https://github.com/jemalloc/jemalloc/commit/d410f43e1f001e394910a50be9a137dbcbc2eae5))
  * Refactor statistics collection and rendering into separate  
gather/emission stages and descriptor-driven tables. ([@spredolac](https://github.com/spredolac):  
[`184f304`](https://github.com/jemalloc/jemalloc/commit/184f304dd33ac053a92804ed653fac191bc50377), [`80c8fcb`](https://github.com/jemalloc/jemalloc/commit/80c8fcb4f91119a896479721d1e46e2ad8c9688f))
  * Introduce an OS abstraction layer and move platform-dependent  
file/process I/O, time, synchronization, CPU, virtual-memory, atfork,  
error-handling, profiling, thread-yield, and configuration-access  
operations out of allocator core code. ([@guangli-dai](https://github.com/guangli-dai): [`c4158ac`](https://github.com/jemalloc/jemalloc/commit/c4158acac9f45321c38a2222b30b546ed0598737),  
[`c8e2e01`](https://github.com/jemalloc/jemalloc/commit/c8e2e0134cd13350e33f77515c00e5eb170dc683), ...)

Portability improvements:

  * Replace the `std::__throw_bad_alloc` call with standard C++ ([#2900](https://github.com/jemalloc/jemalloc/pull/2900)).  
([@lexprfuncall](https://github.com/lexprfuncall): [`1a15fe3`](https://github.com/jemalloc/jemalloc/commit/1a15fe33a48c52bfe26ea83e49f0d317a47da3ea))
  * Make `arena_s` use a flexible array member (`bin_t all_bins[]`) for C99  
or newer. ([@grueninger](https://github.com/grueninger): [`300b58b`](https://github.com/jemalloc/jemalloc/commit/300b58b49ba2df0ca524acff8a57a44af170a1c7))
  * Fix rdtscp detection with `--with-lg-vaddr`. ([@xinydev](https://github.com/xinydev): [`e8a0d2b`](https://github.com/jemalloc/jemalloc/commit/e8a0d2b477d8da7a087bef98feb7e08d320b8051))
  * Fix `malloc_getcpu` on macOS to read the current CPU number correctly.  
([@Algunenano](https://github.com/Algunenano): [`5aabbc8`](https://github.com/jemalloc/jemalloc/commit/5aabbc87bf5c6e2e6842f48bd83de41bfa675acc))
  * Use `CLOCK_MONOTONIC` for background-thread sleep to prevent  
clock-rollback stalls, and detect monotonic-condvar support at configure  
time. ([@antonio2368](https://github.com/antonio2368): [`ebacec3`](https://github.com/jemalloc/jemalloc/commit/ebacec3a1a4ec8b102b9185d897fd8bbde69c313), [`8361239`](https://github.com/jemalloc/jemalloc/commit/8361239b03e9775fd897437d610f249b15fa628a))
  * Fix compilation warnings on macOS. ([@gctony](https://github.com/gctony): [`abb0a8a`](https://github.com/jemalloc/jemalloc/commit/abb0a8a05b7d0acb86184cbc0af2a3ce23d74c79))
  * Fix thread-exit TSD cleanup on MinGW builds. ([@gctony](https://github.com/gctony): [`1e92317`](https://github.com/jemalloc/jemalloc/commit/1e923170140007c10910376a3c69181e24a993de))
  * Fix GCC 16 build warnings by removing `-Wpedantic` violations in macro  
and function syntax and explicitly NUL-terminating profiling thread-name  
copies to resolve `-Wstringop-truncation`. ([@grueninger](https://github.com/grueninger): [`5acdcee`](https://github.com/jemalloc/jemalloc/commit/5acdcee60012cb6bbb4d5ecd7f7e2555c88ef404),  
[`c22d929`](https://github.com/jemalloc/jemalloc/commit/c22d929ab42a4873fcad01e3e044c7247eb04b1e), [@jasonangelov](https://github.com/jasonangelov): [`6a245e0`](https://github.com/jemalloc/jemalloc/commit/6a245e022acddaae5b4164e48855723b943fc032))
  * Parse PID-namespace symlinks without glibc-dependent `strtok`/`atol`,  
and return identifiers as `uint64_t`. ([@guangli-dai](https://github.com/guangli-dai): [`278d90a`](https://github.com/jemalloc/jemalloc/commit/278d90a502aa9601ec5214ad859c050109b13d27))

### Contributors

  * [ ](https://github.com/fzakaria)
  * [ ](https://github.com/Algunenano)
  * [ ](https://github.com/ibookstein)
  * [ ](https://github.com/lexprfuncall)
  * [ ](https://github.com/spredolac)
  * [ ](https://github.com/bigbruno)
  * [ ](https://github.com/xinydev)
  * [ ](https://github.com/binliu19)
  * [ ](https://github.com/guangli-dai)
  * [ ](https://github.com/antonio2368)
  * [ ](https://github.com/grueninger)
  * [ ](https://github.com/jasonangelov)
  * [ ](https://github.com/gctony)

fzakaria, Algunenano, and 11 other contributors 

Assets 3

Loading

###  Uh oh! 

There was an error while loading. [Please reload this page]().

10 people reacted

0  [ Join discussion ](/jemalloc/jemalloc/discussions/3005)
