diff --git a/scripts/vendored-checksums.txt b/scripts/vendored-checksums.txt index ef424f4a13..224b6cd803 100644 --- a/scripts/vendored-checksums.txt +++ b/scripts/vendored-checksums.txt @@ -1024,7 +1024,7 @@ ce14eb6dfd55f241095b55f70983931a2d92f7a6a622a9b360cdd70ab3b53208 vendored/mimal 247a9952465eb105be03a9962e922b085ce5d52034775551a61cd8594275be73 vendored/mimalloc/src/prim/osx/prim.c cc771788e5ba591efb681829a8724f8662a1f50f3db39cf5ebe7738b8ed57e44 vendored/mimalloc/src/prim/prim.c 792531421c247fca0766ff7630057ec491173578ca4d1919ae34f05eb289ccf4 vendored/mimalloc/src/prim/readme.md -c1ae32eaac7ccf18c10058cca99723892f8bd027318590151f5011c929c7e3be vendored/mimalloc/src/prim/unix/prim.c +20594d38ef4fc0c641f20a8664d17ee03ce195ca21b44e036f43cdb7bcd0bd0d vendored/mimalloc/src/prim/unix/prim.c bee9c655a17e1e93bf4908e0a902fd3b566628447b1446fcbfa92bca2e76ca15 vendored/mimalloc/src/prim/wasi/prim.c f70e61a1f2fe63da2f51c581895cf4a0918a9bffb0cf8600171f297141446962 vendored/mimalloc/src/prim/windows/etw-mimalloc.wprp 4f3110ef2054c95cb275be96cb279224d3d46a728c5117bd1435425f382de778 vendored/mimalloc/src/prim/windows/etw.h diff --git a/vendored/mimalloc/src/prim/unix/prim.c b/vendored/mimalloc/src/prim/unix/prim.c index bec22c0ba7..93563f587d 100644 --- a/vendored/mimalloc/src/prim/unix/prim.c +++ b/vendored/mimalloc/src/prim/unix/prim.c @@ -500,7 +500,18 @@ int _mi_prim_decommit(void* start, size_t size, bool* needs_recommit) { // decommit: use MADV_DONTNEED as it decreases rss immediately (unlike MADV_FREE) err = unix_madvise(start, size, MADV_DONTNEED); #endif - #if !MI_DEBUG && MI_SECURE<=2 + // codebase-memory-mcp local change (2026-10-10): macOS always takes the + // recommit path that upstream reserves for MI_DEBUG / MI_SECURE>2 builds. + // In the release path a purged range stays "committed" and is re-accounted as + // a whole with MADV_FREE_REUSE when the arena hands it out again + // (arena.c, _mi_os_reuse), so macOS charges its pages to phys_footprint + // whether or not they are touched; recommitting instead charges only the + // pages that are written. Measured on the indexer (Apple arm64, macOS 26.6), + // peak phys_footprint release -> this change, wall time unchanged and the + // graph byte-identical: TypeScript 1.98 -> 1.09 GB, kubernetes 2.92 -> 1.88 GB, + // dotnet/runtime 12.7 -> 10.6 GB, linux kernel 16.0 -> 13.5 GB. Other + // platforms keep upstream's behaviour (MADV_DONTNEED drops RSS at once). + #if !MI_DEBUG && MI_SECURE<=2 && !defined(__APPLE__) *needs_recommit = false; #else *needs_recommit = true;