Library

jemalloc 5.4.0

Version5.4.0
Stars★ 11,126
Released2026-09-17

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…

Release notes

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: be2de8cc)
  - Allow resuming per-CPU arena selection via `thread.arena`.
    (@algunenano: 68c35f65)
  - Better align the contents of human-readable and JSON malloc statistics.
    (@spredolac: 68fe1be1, 30b1a410, 04aad97f)
  - 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: 160ab9d7, fe336672)

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: d13fe91a)

Bug fixes:
  - Preserve `errno` across `free`, `free_sized`, and `free_aligned_sized`,
    and across `process_madvise`-based page purging.  (@spredolac: 3a779661,
    86f05828)
  - Fix numeric overflow checks in size classes.  (@spredolac: 6b245225)
  - Accept NULL in `free_sized()` and `free_aligned_sized()` (C23
    correctness).  (@bigbruno: 7ce8b916)
  - 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: 54f22c83, @spredolac: fb5499aa)
  - Use `O_CLOEXEC` when opening the THP sysfs file in `init_thp_state`.
    (@ibookstein: d0705543)
  - Fix duplicate `opt.stats_print` and `opt.stats_print_opts` fields in
    `malloc_stats_print` output.  (@spredolac: dfe3a2ed)
  - Fix a potential deadlock during `arena_reset`.  (@guangli-dai: 6957341f)
  - Fix a prof-sampling / guard-page interaction bug in the SAN.  (@gctony:
    e36a0fa5)

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:
    ba1e2fe4, 88745978, 9d757223, de9ad145, ...)
  - 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: 9e143468,
    901365d4, 4e903a0a, 5bc8d6e9)
  - Cap the base-block growth heuristic to avoid virtual-memory exhaustion
    under rare racy conditions.  (@guangli-dai: 2f4db8cf)
  - Move background-thread lifecycle and state operations into the
    background-thread module, clarifying ownership independently of PAC/HPA
    callers.  (@guangli-dai: f1f07923)
  - Simplify the page-allocation boundary by repla…

Share this resource


Discovered 2026-09-18 Source GitHub Archive 2026-09 →