head 1.8; access; symbols pkgsrc-2026Q1:1.7.0.24 pkgsrc-2026Q1-base:1.7 pkgsrc-2025Q4:1.7.0.22 pkgsrc-2025Q4-base:1.7 pkgsrc-2025Q3:1.7.0.20 pkgsrc-2025Q3-base:1.7 pkgsrc-2025Q2:1.7.0.18 pkgsrc-2025Q2-base:1.7 pkgsrc-2025Q1:1.7.0.16 pkgsrc-2025Q1-base:1.7 pkgsrc-2024Q4:1.7.0.14 pkgsrc-2024Q4-base:1.7 pkgsrc-2024Q3:1.7.0.12 pkgsrc-2024Q3-base:1.7 pkgsrc-2024Q2:1.7.0.10 pkgsrc-2024Q2-base:1.7 pkgsrc-2024Q1:1.7.0.8 pkgsrc-2024Q1-base:1.7 pkgsrc-2023Q4:1.7.0.6 pkgsrc-2023Q4-base:1.7 pkgsrc-2023Q3:1.7.0.4 pkgsrc-2023Q3-base:1.7 pkgsrc-2023Q2:1.7.0.2 pkgsrc-2023Q2-base:1.7 pkgsrc-2022Q3:1.5.0.30 pkgsrc-2022Q3-base:1.5 pkgsrc-2022Q2:1.5.0.28 pkgsrc-2022Q2-base:1.5 pkgsrc-2022Q1:1.5.0.26 pkgsrc-2022Q1-base:1.5 pkgsrc-2021Q4:1.5.0.24 pkgsrc-2021Q4-base:1.5 pkgsrc-2021Q3:1.5.0.22 pkgsrc-2021Q3-base:1.5 pkgsrc-2021Q2:1.5.0.20 pkgsrc-2021Q2-base:1.5 pkgsrc-2021Q1:1.5.0.18 pkgsrc-2021Q1-base:1.5 pkgsrc-2020Q4:1.5.0.16 pkgsrc-2020Q4-base:1.5 pkgsrc-2020Q3:1.5.0.14 pkgsrc-2020Q3-base:1.5 pkgsrc-2020Q2:1.5.0.12 pkgsrc-2020Q2-base:1.5 pkgsrc-2020Q1:1.5.0.8 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.10 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.6 pkgsrc-2019Q3-base:1.5 pkgsrc-2019Q2:1.5.0.4 pkgsrc-2019Q2-base:1.5 pkgsrc-2019Q1:1.5.0.2 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.2.0.14 pkgsrc-2018Q4-base:1.2 pkgsrc-2018Q3:1.2.0.12 pkgsrc-2018Q3-base:1.2 pkgsrc-2018Q2:1.2.0.10 pkgsrc-2018Q2-base:1.2 pkgsrc-2018Q1:1.2.0.8 pkgsrc-2018Q1-base:1.2 pkgsrc-2017Q4:1.2.0.6 pkgsrc-2017Q4-base:1.2 pkgsrc-2017Q3:1.2.0.4 pkgsrc-2017Q3-base:1.2 pkgsrc-2017Q2:1.1.0.2 pkgsrc-2017Q2-base:1.1; locks; strict; comment @ * @; 1.8 date 2026.04.14.12.49.12; author adam; state dead; branches; next 1.7; commitid 4dcIKm8Go8oMtVBG; 1.7 date 2023.05.31.21.04.17; author christos; state Exp; branches; next 1.6; commitid UcldboTGv2G6W9rE; 1.6 date 2022.09.26.18.02.21; author wiz; state dead; branches; next 1.5; commitid POkvJh0UCSGHRoVD; 1.5 date 2019.03.22.16.30.02; author rin; state Exp; branches; next 1.4; commitid JcRgTwgsBwzMCngB; 1.4 date 2019.03.22.15.55.17; author schmonz; state Exp; branches; next 1.3; commitid GDfmaNTPIJzmrngB; 1.3 date 2019.03.17.13.28.22; author rin; state Exp; branches; next 1.2; commitid Z8cPbf58wW5SMIfB; 1.2 date 2017.08.27.12.12.25; author adam; state Exp; branches; next 1.1; commitid axkOs6k660vxAQ4A; 1.1 date 2017.05.17.16.36.46; author gson; state Exp; branches; next ; commitid b2GqECS576bEkLRz; desc @@ 1.8 log @jemalloc: updated to 5.3.1 5.3.1 (Apr 13, 2026) 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. @ text @$NetBSD: patch-src_pages.c,v 1.7 2023/05/31 21:04:17 christos Exp $ Don't affect global state when making alignment modifications to the mmap flags. diff --git a/src/pages.c b/src/pages.c index 09b51b88..2d5b8164 100644 --- src/pages.c +++ src/pages.c @@@@ -155,6 +155,7 @@@@ os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) { * of existing mappings, and we only want to create new mappings. */ { + int flags = mmap_flags; #ifdef __NetBSD__ /* * On NetBSD PAGE for a platform is defined to the @@@@ -164,12 +165,12 @@@@ os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) { */ if (alignment > os_page || PAGE > os_page) { unsigned int a = ilog2(MAX(alignment, PAGE)); - mmap_flags |= MAP_ALIGNED(a); + flags |= MAP_ALIGNED(a); } #endif int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT; - ret = mmap(addr, size, prot, mmap_flags, PAGES_FD_TAG, 0); + ret = mmap(addr, size, prot, flags, PAGES_FD_TAG, 0); } assert(ret != NULL); @ 1.7 log @Fix for over-alignment bug from Andreas Gustafsson @ text @d1 1 a1 1 $NetBSD$ @ 1.6 log @jemalloc: update to 5.3.0. * 5.3.0 (May 6, 2022) This release contains many speed and space optimizations, from micro optimizations on common paths to rework of internal data structures and locking schemes, and many more too detailed to list below. Multiple percent of system level metric improvements were measured in tested production workloads. The release has gone through large-scale production testing. New features: - Add the thread.idle mallctl which hints that the calling thread will be idle for a nontrivial period of time. (@@davidtgoldblatt) - Allow small size classes to be the maximum size class to cache in the thread-specific cache, through the opt.[lg_]tcache_max option. (@@interwq, @@jordalgo) - Make the behavior of realloc(ptr, 0) configurable with opt.zero_realloc. (@@davidtgoldblatt) - Add 'make uninstall' support. (@@sangshuduo, @@Lapenkov) - Support C++17 over-aligned allocation. (@@marksantaniello) - Add the thread.peak mallctl for approximate per-thread peak memory tracking. (@@davidtgoldblatt) - Add interval-based stats output opt.stats_interval. (@@interwq) - Add prof.prefix to override filename prefixes for dumps. (@@zhxchen17) - Add high resolution timestamp support for profiling. (@@tyroguru) - Add the --collapsed flag to jeprof for flamegraph generation. (@@igorwwwwwwwwwwwwwwwwwwww) - Add the --debug-syms-by-id option to jeprof for debug symbols discovery. (@@DeannaGelbart) - Add the opt.prof_leak_error option to exit with error code when leak is detected using opt.prof_final. (@@yunxuo) - Add opt.cache_oblivious as an runtime alternative to config.cache_oblivious. (@@interwq) - Add mallctl interfaces: + opt.zero_realloc (@@davidtgoldblatt) + opt.cache_oblivious (@@interwq) + opt.prof_leak_error (@@yunxuo) + opt.stats_interval (@@interwq) + opt.stats_interval_opts (@@interwq) + opt.tcache_max (@@interwq) + opt.trust_madvise (@@azat) + prof.prefix (@@zhxchen17) + stats.zero_reallocs (@@davidtgoldblatt) + thread.idle (@@davidtgoldblatt) + thread.peak.{read,reset} (@@davidtgoldblatt) Bug fixes: - Fix the synchronization around explicit tcache creation which could cause invalid tcache identifiers. This regression was first released in 5.0.0. (@@yoshinorim, @@davidtgoldblatt) - Fix a profiling biasing issue which could cause incorrect heap usage and object counts. This issue existed in all previous releases with the heap profiling feature. (@@davidtgoldblatt) - Fix the order of stats counter updating on large realloc which could cause failed assertions. This regression was first released in 5.0.0. (@@azat) - Fix the locking on the arena destroy mallctl, which could cause concurrent arena creations to fail. This functionality was first introduced in 5.0.0. (@@interwq) Portability improvements: - Remove nothrow from system function declarations on macOS and FreeBSD. (@@davidtgoldblatt, @@fredemmott, @@leres) - Improve overcommit and page alignment settings on NetBSD. (@@zoulasc) - Improve CPU affinity support on BSD platforms. (@@devnexen) - Improve utrace detection and support. (@@devnexen) - Improve QEMU support with MADV_DONTNEED zeroed pages detection. (@@azat) - Add memcntl support on Solaris / illumos. (@@devnexen) - Improve CPU_SPINWAIT on ARM. (@@AWSjswinney) - Improve TSD cleanup on FreeBSD. (@@Lapenkov) - Disable percpu_arena if the CPU count cannot be reliably detected. (@@azat) - Add malloc_size(3) override support. (@@devnexen) - Add mmap VM_MAKE_TAG support. (@@devnexen) - Add support for MADV_[NO]CORE. (@@devnexen) - Add support for DragonFlyBSD. (@@devnexen) - Fix the QUANTUM setting on MIPS64. (@@brooksdavis) - Add the QUANTUM setting for ARC. (@@vineetgarc) - Add the QUANTUM setting for LoongArch. (@@wangjl-uos) - Add QNX support. (@@jqian-aurora) - Avoid atexit(3) calls unless the relevant profiling features are enabled. (@@BusyJay, @@laiwei-rice, @@interwq) - Fix unknown option detection when using Clang. (@@Lapenkov) - Fix symbol conflict with musl libc. (@@georgthegreat) - Add -Wimplicit-fallthrough checks. (@@nickdesaulniers) - Add __forceinline support on MSVC. (@@santagada) - Improve FreeBSD and Windows CI support. (@@Lapenkov) - Add CI support for PPC64LE architecture. (@@ezeeyahoo) Incompatible changes: - Maximum size class allowed in tcache (opt.[lg_]tcache_max) now has an upper bound of 8MiB. (@@interwq) Optimizations and refactors (@@davidtgoldblatt, @@Lapenkov, @@interwq): - Optimize the common cases of the thread cache operations. - Optimize internal data structures, including RB tree and pairing heap. - Optimize the internal locking on extent management. - Extract and refactor the internal page allocator and interface modules. Documentation: - Fix doc build with --with-install-suffix. (@@lawmurray, @@interwq) - Add PROFILING_INTERNALS.md. (@@davidtgoldblatt) - Ensure the proper order of doc building and installation. (@@Mingli-Yu) @ text @d1 1 a1 1 $NetBSD: patch-src_pages.c,v 1.5 2019/03/22 16:30:02 rin Exp $ d3 2 a4 3 Set os_overcommits to true on NetBSD < 8.0 as a workaround for the issue reported in kern/52239 and https://github.com/jemalloc/jemalloc/issues/837 . d6 24 a29 4 --- src/pages.c.orig 2018-05-09 04:15:01.000000000 +0900 +++ src/pages.c 2019-03-23 01:24:38.101144076 +0900 @@@@ -582,6 +582,12 @@@@ pages_boot(void) { mmap_flags |= MAP_NORESERVE; d31 2 a32 10 # endif +#elif defined(__NetBSD__) +# if !__NetBSD_Prereq__(8,0,0) + os_overcommits = true; +# else + os_overcommits = false; +# endif #else os_overcommits = false; #endif @ 1.5 log @Fix previous; initialize os_overcommits for NetBSD >= 8.0. @ text @d1 1 a1 1 $NetBSD: patch-src_pages.c,v 1.4 2019/03/22 15:55:17 schmonz Exp $ @ 1.4 log @Fix "token is not a valid binary operator in a preprocessor subexpression" on OS X by nesting the "!__NetBSD_Prereq__(8,0,0)" check in another #if. @ text @d1 1 a1 1 $NetBSD: patch-src_pages.c,v 1.3 2019/03/17 13:28:22 rin Exp $ d7 3 a9 3 --- src/pages.c.orig 2018-05-08 19:15:01.000000000 +0000 +++ src/pages.c @@@@ -582,6 +582,10 @@@@ pages_boot(void) { d16 2 @ 1.3 log @Bump revision in order to make it easier to compare with local jemalloc of NetBSD: - restrict "os_overcommits" workaround to NetBSD < 8.0 - add debug option @ text @d1 1 a1 1 $NetBSD$ d7 3 a9 3 --- src/pages.c.orig 2018-05-09 04:15:01.000000000 +0900 +++ src/pages.c 2019-03-17 22:02:09.325743870 +0900 @@@@ -582,6 +582,8 @@@@ pages_boot(void) { d13 2 a14 1 +#elif defined(__NetBSD__) && !__NetBSD_Prereq__(8,0,0) d16 1 @ 1.2 log @5.0.1: This bugfix release fixes several issues, most of which are obscure enough that typical applications are not impacted. Bug fixes: Update decay->nunpurged before purging, in order to avoid potential update races and subsequent incorrect purging volume. Only abort on dlsym(3) error if the failure impacts an enabled feature (lazy locking and/or background threads). This mitigates an initialization failure bug for which we still do not have a clear reproduction test case. Modify tsd management so that it neither crashes nor leaks if a thread's only allocation activity is to call free() after TLS destructors have been executed. This behavior was observed when operating with GNU libc, and is unlikely to be an issue with other libc implementations. Mask signals during background thread creation. This prevents signals from being inadvertently delivered to background threads. Avoid inactivity checks within background threads, in order to prevent recursive mutex acquisition. Fix extent_grow_retained() to use the specified hooks when the arena..extent_hooks mallctl is used to override the default hooks. Add missing reentrancy support for custom extent hooks which allocate. Post-fork(2), re-initialize the list of tcaches associated with each arena to contain no tcaches except the forking thread's. Add missing post-fork(2) mutex reinitialization for extent_grow_mtx. This fixes potential deadlocks after fork(2). Enforce minimum autoconf version (currently 2.68), since 2.63 is known to generate corrupt configure scripts. Ensure that the configured page size (--with-lg-page) is no larger than the configured huge page size (--with-lg-hugepage). @ text @d1 1 a1 1 $NetBSD: patch-src_pages.c,v 1.1 2017/05/17 16:36:46 gson Exp $ d3 2 a4 2 Set os_overcommits to true on NetBSD since NetBSD does overcommit. This also has the benefit of not triggering the issue reported in d7 3 a9 3 --- src/pages.c.orig 2017-07-02 00:44:25.000000000 +0000 +++ src/pages.c @@@@ -414,6 +414,8 @@@@ pages_boot(void) { d13 1 a13 1 +#elif defined __NetBSD__ @ 1.1 log @Set os_overcommits to true on NetBSD since NetBSD does overcommit. This also has the benefit of not triggering the issue reported in https://github.com/jemalloc/jemalloc/issues/837 . @ text @d1 1 a1 1 $NetBSD$ d7 1 a7 1 --- src/pages.c.orig 2017-03-01 03:10:36.000000000 +0000 d9 1 a9 2 @@@@ -296,6 +296,8 @@@@ pages_boot(void) if (os_overcommits) d11 1 @