LmCast :: Stay tuned in

Jemalloc 5.4.0

Recorded: Sept. 18, 2026, 6:09 a.m.

Original Summarized

Release 5.4.0 · jemalloc/jemalloc · GitHub

Skip to content

Navigation MenuSign inAppearance settingsPlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesCode QualityEnforce quality at mergeAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricingSearch/Sign inSign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

jemalloc

/

jemalloc

Public

Notifications
You must be signed in to change notification settings

Fork
1.6k

Star
11.1k

Code

Issues
339

Pull requests
27

Discussions

Actions

Wiki

Security and quality
0

Insights

Additional navigation options

Code

Issues

Pull requests

Discussions

Actions

Wiki

Security and quality

Insights

Releases
5.4.0

5.4.0

Latest

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

guangli-dai

released this


17 Sep 18:31

·

5 commits

to dev
since this release

5.4.0

7a34f18

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: be2de8c)
Allow resuming per-CPU arena selection via thread.arena.
(@Algunenano: 68c35f6)
Better align the contents of human-readable and JSON malloc statistics.
(@spredolac: 68fe1be, 30b1a41, 04aad97)
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: 160ab9d, fe33667)

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

Bug fixes:

Preserve errno across free, free_sized, and free_aligned_sized,
and across process_madvise-based page purging. (@spredolac: 3a77966,
86f0582)
Fix numeric overflow checks in size classes. (@spredolac: 6b24522)
Accept NULL in free_sized() and free_aligned_sized() (C23
correctness). (@bigbruno: 7ce8b91)
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: 54f22c8, @spredolac: fb5499a)
Use O_CLOEXEC when opening the THP sysfs file in init_thp_state.
(@ibookstein: d070554)
Fix duplicate opt.stats_print and opt.stats_print_opts fields in
malloc_stats_print output. (@spredolac: dfe3a2e)
Fix a potential deadlock during arena_reset. (@guangli-dai: 6957341)
Fix a prof-sampling / guard-page interaction bug in the SAN. (@gctony:
e36a0fa)

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:
ba1e2fe, 8874597, 9d75722, de9ad14, ...)
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: 9e14346,
901365d, 4e903a0, 5bc8d6e)
Cap the base-block growth heuristic to avoid virtual-memory exhaustion
under rare racy conditions. (@guangli-dai: 2f4db8c)
Move background-thread lifecycle and state operations into the
background-thread module, clarifying ownership independently of PAC/HPA
callers. (@guangli-dai: f1f0792)
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: 1dfa6f7, 8edd101, d410f43)
Refactor statistics collection and rendering into separate
gather/emission stages and descriptor-driven tables. (@spredolac:
184f304, 80c8fcb)
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: c4158ac,
c8e2e01, ...)

Portability improvements:

Replace the std::__throw_bad_alloc call with standard C++ (#2900).
(@lexprfuncall: 1a15fe3)
Make arena_s use a flexible array member (bin_t all_bins[]) for C99
or newer. (@grueninger: 300b58b)
Fix rdtscp detection with --with-lg-vaddr. (@xinydev: e8a0d2b)
Fix malloc_getcpu on macOS to read the current CPU number correctly.
(@Algunenano: 5aabbc8)
Use CLOCK_MONOTONIC for background-thread sleep to prevent
clock-rollback stalls, and detect monotonic-condvar support at configure
time. (@antonio2368: ebacec3, 8361239)
Fix compilation warnings on macOS. (@gctony: abb0a8a)
Fix thread-exit TSD cleanup on MinGW builds. (@gctony: 1e92317)
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: 5acdcee,
c22d929, @jasonangelov: 6a245e0)
Parse PID-namespace symlinks without glibc-dependent strtok/atol,
and return identifiers as uint64_t. (@guangli-dai: 278d90a)


Contributors

fzakaria, Algunenano, and 11 other contributors


Assets
3

Loading

Uh oh!

There was an error while loading. Please reload this page.


🎉
6
Kriskras99, JaySon-Huang, deadmarshal, kkocdko, Safari77, and Tipuch reacted with hooray emoji
❤️
1
kkocdko reacted with heart emoji
👀
1
JaySon-Huang reacted with eyes emoji


All reactions

🎉
6 reactions

❤️
1 reaction

👀
1 reaction

6 people reacted

0


Join discussion

Footer

© 2026 GitHub, Inc.

Footer navigation

Terms

Privacy

Security

Status

Community

Docs

Contact

Manage cookies

Do not share my personal information

You can’t perform that action at this time.

Release 5.4.0 of jemalloc primarily focused on technical debt cleaning, including refactorings, bug fixes, improving test coverage, and streamlining option cleanups, alongside incorporating portability improvements based on upstream reports. New features introduced include EXTENT_ALLOC_FLAG_PINNED to allow custom extent-allocation hooks to mark non-reclaimable mappings, such as HugeTLB pages, for preferential reuse outside the decay and purge pipeline. Furthermore, new mallctl interfaces were added to report pinned-memory usage and mutex statistics, specifically 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}. The release also allowed resuming per-CPU arena selection via thread.arena. Authors also improved the alignment of contents within human-readable and JSON malloc statistics.

The release included incompatible changes, which involved adapting tcache fill and retention targets per bin to reflect the demand observed between garbage collection events, replacing the previous fixed refill/flush policy. Several legacy non-experimental controls were removed, such as 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 were silently ignored, and tcache_ncached_max remained supported.

Numerous bug fixes were addressed, including preserving errno across free, free_sized, and free_aligned_sized operations, and across process_madvise-based page purging. Checks for numeric overflow in size classes were fixed, and NULL values were now accepted in free_sized() and free_aligned_sized() to ensure C23 correctness. TSD lifecycle edge cases were resolved by initializing thread-cache bins before marking the cache enabled to prevent reentrant bootstrap allocations from using uninitialized state, and by avoiding TSD recreation for late deallocations after thread teardown on generic-TSD platforms. Additional fixes included using O_CLOEXEC when opening the THP sysfs file in init_thp_state, fixing duplicate fields in malloc_stats_print output, and resolving a potential deadlock during arena_reset. A bug involving prof-sampling/guard-page interaction in the SAN was also fixed.

Significant optimizations and refactorings were implemented to improve the internal structure. This involved modularizing jemalloc's front end by extracting arena management, initialization, fork orchestration, and allocation dispatch from jemalloc.c, untangling tcache/arena ownership, and consolidating the internal header graph to eliminate circular dependencies. Control dispatch was simplified by refactoring arena helpers, internalizing an implementation-only control, replacing control-flow macros with typed helpers, and organizing ctl.c by subsystem. The base-block growth heuristic was capped to prevent virtual-memory exhaustion under rare racy conditions. Background-thread lifecycle and state operations were moved into the background-thread module for clearer ownership. The page-allocation boundary was simplified by replacing PAI vtable dispatch with direct PAC/HPA calls, eliminating the obsolete pai_t/pai.h abstraction, and moving deferred-work and decay orchestration out of the arena. Statistics collection and rendering were refactored into separate gather/emission stages and descriptor-driven tables. Finally, an OS abstraction layer was introduced to move platform-dependent operations like file/process I/O, time, synchronization, CPU, virtual-memory, atfork, error-handling, profiling, thread-yield, and configuration access out of the allocator core code.

Portability improvements were also incorporated, such as replacing the std::__throw_bad_alloc call with standard C++, making arena_s use a flexible array member for C99 or newer, fixing rdtscp detection with --with-lg-vaddr, and correcting the behavior of malloc_getcpu on macOS to correctly read the current CPU number. Furthermore, changes were made to use CLOCK_MONOTONIC for background-thread sleep to prevent clock-rollback stalls and to detect monotonic-condvar support at configuration time. Various compilation warnings were fixed on macOS, thread-exit TSD cleanup was fixed for MinGW builds, and GCC 16 build warnings were addressed by removing -Wpedantic violations and ensuring proper NUL-termination of profiling thread-name copies. Finally, parsing of PID-namespace symlinks was updated to avoid glibc-dependent functions, returning identifiers as uint64_t.