From GitHub · · 1m 40s
jemalloc 5.4.0 ships with 160+ commits
A major memory allocator update focuses on technical debt, new pinned-memory features, and broad portability fixes.
In brief
A major memory allocator update focuses on technical debt, new pinned-memory features, and broad portability fixes. jemalloc 5.4.0 modernizes the codebase with refactoring and new capabilities while removing legacy options that no longer serve users. Originally reported by GitHub.
jemalloc 5.4.0 released
Over 160 commits ship in this release, focusing on technical debt cleanup, refactoring, bug fixes, and portability improvements across platforms.
“This release contains over 160 commits, focusing on the technical debts cleaning including refactorings, bug fixes, test coverage improvement, and option cleanups.”
Pinned memory tracking added
New EXTENT_ALLOC_FLAG_PINNED flag lets custom extent hooks mark non-reclaimable mappings like HugeTLB pages for preferential reuse, with new mallctl interfaces to report pinned-memory usage.
Per-CPU arena selection resumed
Users can now resume per-CPU arena selection via the thread.arena interface, restoring flexibility in how threads allocate memory.
Legacy tcache options removed
Seven legacy non-experimental tcache controls are removed, replaced by adaptive fill and retention targets that adjust per bin based on observed demand between garbage collection events.
Critical bug fixes shipped
Fixes include errno preservation across free operations, numeric overflow checks in size classes, C23 correctness for NULL in free functions, and TSD lifecycle edge cases that prevented reentrant bootstrap issues.
Major code refactoring completed
jemalloc's front end was modularized by extracting arena management, initialization, and allocation dispatch. Control dispatch was simplified and an OS abstraction layer was introduced to isolate platform-dependent code.
Portability across platforms improved
Fixes address macOS CPU detection, MinGW thread-exit cleanup, GCC 16 warnings, clock-rollback stalls on background threads, and PID-namespace symlink parsing without glibc dependencies.
Statistics and JSON output aligned
Human-readable and JSON malloc statistics are now better aligned, and statistics collection was refactored into separate gather and emission stages using descriptor-driven tables.
The bottom line
jemalloc 5.4.0 modernizes the codebase with refactoring and new capabilities while removing legacy options that no longer serve users.

