| 1.1.1.1 |
| 19-Apr-2026 |
christos | Import jemalloc-5.3.1 (previous was 5.3.0)
This release includes over 390 commits spanning bug fixes, new features, performance optimizations, and portability improvements. Multiple percent of system-level metric improvements were measured in tested production workloads. The release has gone through large-scale production testing at Meta.
New features:
Support pvalloc. (@Lapenkov: 5b1f2cc) Add double free detection for the debug build. (@izaitsevfb: 36366f3, @guangli-dai: 42daa1a, @divanorama: 1897f18) Add compile-time option --enable-pageid to enable memory mapping annotation. (@devnexen: 4fc5c4f) Add runtime option prof_bt_max to control the max stack depth for profiling. (@guangli-dai: a0734fd) Add compile-time option --enable-force-getenv to use getenv instead of secure_getenv. (@interwq: 481bbfc) Add compile-time option --disable-dss to disable the usage of sbrk(2). (@Svetlitski: ea5b7be) Add runtime option tcache_ncached_max to control the number of items in each size bin in the thread cache. (@guangli-dai: 8a22d10) Add runtime option calloc_madvise_threshold to determine if kernel or memset is used to zero the allocations for calloc. (@nullptr0-0: 5081c16) Add compile-time option --disable-user-config to disable reading the runtime configurations from /etc/malloc.conf or environment variable MALLOC_CONF. (@roblabla: c17bf8b) Add runtime option disable_large_size_classes to guard the new usable size calculation, which minimizes the memory overhead for large allocations, i.e., >= 4 * PAGE. (@guangli-dai: c067a55, 8347f10) Enable process_madvise usage, add runtime option process_madvise_max_batch to control the max # of regions in each madvise batch. (@interwq: 22440a0, @spredolac: 4246475) Add mallctl interfaces: opt.prof_bt_max (@guangli-dai: a0734fd) arena.<i>.name to set and get arena names. (@guangli-dai: ba19d2c) thread.tcache.max to set and get the tcache_max of the current thread. (@guangli-dai: a442d9b) thread.tcache.ncached_max.write and thread.tcache.ncached_max.read_sizeclass to set and get the ncached_max setup of the current thread. (@guangli-dai: 630f7de, 6b197fd) arenas.hugepage to return the hugepage size used, also exported to malloc stats. (@ilvokhin: 90c627e) approximate_stats.active to return an estimate of the current active bytes, which should not be compared with other stats retrieved. (@guangli-dai: 0988583) Bug fixes:
Prevent potential deadlocks in decaying during reentrancy. (@interwq: 434a68e) Fix segfault in extent coalescing. (@Svetlitski: 12311fe) Add null pointer detections in mallctl calls. (@Svetlitski: dc0a184, 0288126) Make mallctl arenas.lookup triable without crashing on invalid pointers. (@auxten: 019cccc, 5bac384) Demote sampled allocations for proper deallocations during arena_reset. (@Svetlitski: 62648c8) Fix jemalloc's read(2) and write(2). (@Svetlitski: d2c9ed3, @lexprfuncall: 9fdc116) Fix the pkg-config metadata file. (@BtbN: ed7e6fe, ce8ce99) Fix the autogen.sh so that it accepts quoted extra options. (@honggyukim: f6fe6ab) Fix rallocx() to set errno to ENOMEM upon OOMing. (@arter97: 38056fe, @interwq: 83b0757) Avoid stack overflow for internal variable array usage. (@nullptr0-0: 47c9bcd, 48f66cf, @xinydev: 9169e92) Fix background thread initialization race. (@puzpuzpuz: 4d0ffa0) Guard os_page_id against a NULL address. (@lexprfuncall: 79cc7dc) Handle tcache init failures gracefully. (@lexprfuncall: a056c20) Fix missing release of acquired neighbor edata in extent_try_coalesce_impl. (@spredolac: 675ab07) Fix memory leak of old curr_reg on san_bump_grow_locked failure. (@spredolac: 5904a42) Fix large alloc nrequests under-counting on cache misses. (@spredolac: 3cc56d3) Portability improvements:
Fix the build in C99. (@abaelhe: 56ddbea) Add pthread_setaffinity_np detection for non Linux/BSD platforms. (@devnexen: 4c95c95) Make VARIABLE_ARRAY compatible with compilers not supporting VLA, i.e., Visual Studio C compiler in C11 or C17 modes. (@madscientist: be65438) Fix the build on Linux using musl library. (@marv: aba1645, 45249cf) Reduce the memory overhead in small allocation sampling for systems with larger page sizes, e.g., ARM. (@Svetlitski: 5a858c6) Add C23's free_sized and free_aligned_sized. (@Svetlitski: cdb2c0e) Enable heap profiling on MacOS. (@nullptr0-0: 4b555c1) Fix incorrect printing on 32bit. (@sundb: 630434b) Make JEMALLOC_CXX_THROW compatible with C++ versions newer than C++17. (@r-barnes, @guangli-dai: 21bcc0a) Fix mmap tag conflicts on MacOS. (@kdrag0n: c893fcd) Fix monotonic timer assumption for win32. (@burtonli: 8dc97b1) Fix VM over-reservation on systems with larger pages, e.g., aarch64. (@interwq: cd05b19) Remove unreachable() macro conditionally to prevent definition conflicts for C23+. (@appujee: d8486b2, 4b88bdd) Fix dlsym failure observed on FreeBSD. (@rhelmot: 86bbaba) Change the default page size to 64KB on aarch64 Linux. (@lexprfuncall: 9442300) Update config.guess and config.sub to the latest version. (@lexprfuncall: c51949e) Determine the page size on Android from NDK header files. (@lexprfuncall: c51abba) Improve the portability of grep patterns in configure.ac. (@lexprfuncall: 365747b) Add compile-time option --with-cxx-stdlib to specify the C++ standard library. (@yuxuanchen1997: a10ef3e) Optimizations and refactors:
Enable tcache for deallocation-only threads. (@interwq: 143e9c4) Inline to accelerate operator delete. (@guangli-dai: e8f9f13) Optimize pairing heap's performance. (@deadalnix: 5266152, be6da4f, 543e2d6, 10d7131, 92aa52c, @Svetlitski: 36ca0c1) Inline the storage for thread name in the profiling data. (@interwq: ce0b7ab, e62aa47) Optimize a hot function edata_cmp_summary_comp to accelerate it. (@Svetlitski: 6841110, @guangli-dai: 0181aaa) Allocate thread cache using the base allocator, which enables thread cache to use thp when metadata_thp is turned on. (@interwq: 72cfdce) Allow oversize arena not to purge immediately when background threads are enabled, although the default decay time is 0 to be back compatible. (@interwq: d131331) Optimize thread-local storage implementation on Windows. (@mcfi: 9e123a8, 3a0d9cd) Optimize fast path to allow static size class computation. (@interwq: 323ed2e) Redesign tcache GC to regulate the frequency and make it locality-aware. The new design is default on, guarded by option experimental_tcache_gc. (@nullptr0-0: 0c88be9, e2c9f3a, 14d5dc1, @deadalnix: 5afff2e) Reduce the arena switching overhead by avoiding forced purging when background thread is enabled. (@interwq: a3910b9) Improve the reuse efficiency by limiting the maximum coalesced size for large extents. (@jiebinn: 3c14707) Refactor thread events to allow registration of users' thread events and remove prof_threshold as the built-in event. (@spredolac: e6864c6, 015b017, 34ace91) Documentation:
Update Windows building instructions. (@Lapenkov: 3713932) Add vcpkg installation instructions. (@LilyWangLL: c0c9783) Update profiling internals with an example. (@jordalgo: b04e766)
|