From b2ce68a9986cc81d0308d853b49da782898f3154 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 16 Apr 2026 21:36:47 +0200 Subject: [PATCH] Add mimalloc3 --- .github/workflows/platform.yml | 4 ++-- bench.sh | 18 ++++++++++++++---- build-bench-env.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/.github/workflows/platform.yml b/.github/workflows/platform.yml index 4463bece..c51a50a6 100644 --- a/.github/workflows/platform.yml +++ b/.github/workflows/platform.yml @@ -37,7 +37,7 @@ jobs: needs: build-base-with-docker strategy: matrix: - allocator: [ff, fg, gd, hd, hm, iso, je, lf, lp, lt, mesh, mng, mi, mi2, nomesh, pa, rp, scudo, sm, sn, sg, tbb, tc, yal, tcg] + allocator: [ff, fg, gd, hd, hm, iso, je, lf, lp, lt, mesh, mng, mi, mi2, mi3, nomesh, pa, rp, scudo, sm, sn, sg, tbb, tc, yal, tcg] testsuite: [allt] # Used to provide a platform-specific predicate predicate: [true, false] @@ -97,4 +97,4 @@ jobs: allocator=${{ matrix.allocator }} benchs=${{ (contains('lt,lf,gd', matrix.allocator) && 'cfrac espresso barnes larson-sized mstress rptest gs lua') || ('fg' == matrix.allocator && 'cfrac espresso barnes gs lua') || 'allt' }} repeats=1 - cache-from: type=gha,scope=buildkit_${{ inputs.platform }} \ No newline at end of file + cache-from: type=gha,scope=buildkit_${{ inputs.platform }} diff --git a/bench.sh b/bench.sh index eea51483..c145c68b 100755 --- a/bench.sh +++ b/bench.sh @@ -6,8 +6,8 @@ # Allocators and tests # -------------------------------------------------------------------- -readonly alloc_all="sys dh ff fg gd hd hm hml iso je lf lp lt mi mi-sec mi2 mi2-sec mng mesh nomesh pa rp sc scudo sg sm sn sn-sec tbb tc tcg mi-dbg mi2-dbg xmi xsmi xmi-dbg yal rmalloc" -readonly alloc_secure="dh ff gd hm hml iso mi-sec mi2-sec mng pa scudo sg sn-sec sg" +readonly alloc_all="sys dh ff fg gd hd hm hml iso je lf lp lt mi mi-sec mi2 mi2-sec mi3 mi3-sec mng mesh nomesh pa rp sc scudo sg sm sn sn-sec tbb tc tcg mi-dbg mi2-dbg mi3-dbg xmi xsmi xmi-dbg yal rmalloc" +readonly alloc_secure="dh ff gd hm hml iso mi-sec mi2-sec mi3-sec mng pa scudo sg sn-sec sg" alloc_run="" # allocators to run (expanded by command line options) alloc_installed="sys" # later expanded to include all installed allocators alloc_libs="sys=" # mapping from allocator to its .so as "= ..." @@ -133,6 +133,9 @@ alloc_lib_add "mi-dbg" "$localdevdir/mi/out/debug/libmimalloc-debug$extso" alloc_lib_add "mi2" "$localdevdir/mi2/out/release/libmimalloc$extso" alloc_lib_add "mi2-sec" "$localdevdir/mi2/out/secure/libmimalloc-secure$extso" alloc_lib_add "mi2-dbg" "$localdevdir/mi2/out/debug/libmimalloc-debug$extso" +alloc_lib_add "mi3" "$localdevdir/mi3/out/release/libmimalloc$extso" +alloc_lib_add "mi3-sec" "$localdevdir/mi3/out/secure/libmimalloc-secure$extso" +alloc_lib_add "mi3-dbg" "$localdevdir/mi3/out/debug/libmimalloc-debug$extso" xmidir="$localdevdir/../../mi" if ! [ -d "$xmidir" ]; then @@ -230,6 +233,9 @@ fi if is_installed "mi2"; then alloc_installed="$alloc_installed mi2-sec mi2-dbg" # secure mimalloc fi +if is_installed "mi3"; then + alloc_installed="$alloc_installed mi3-sec mi3-dbg" # secure mimalloc +fi if is_installed "hm"; then alloc_installed="$alloc_installed hml" # hardened_malloc light fi @@ -387,8 +393,9 @@ while : ; do echo "" echo "allocators:" echo " dh use dieharder" - echo " mi-dbg use debug version of mimalloc" - echo " mi2-dbg use debug version of mimalloc2" + echo " mi-dbg use debug version of mimalloc" + echo " mi2-dbg use debug version of mimalloc2" + echo " mi3-dbg use debug version of mimalloc3" echo " ff use ffmalloc" echo " fg use freeguard" echo " gd use guarder" @@ -404,6 +411,8 @@ while : ; do echo " mi-sec use secure version of mimalloc" echo " mi2 use mimalloc2" echo " mi2-sec use secure version of mimalloc2" + echo " mi3 use mimalloc3" + echo " mi3-sec use secure version of mimalloc3" echo " mng use mallocng" echo " nomesh use mesh with meshing disabled" echo " pa use PartitionAlloc" @@ -649,6 +658,7 @@ function run_test_cmd { # sys) run_test_env_cmd $1 "sys" "SYSMALLOC=1" "$2" $i;; mi-dbg) run_test_env_cmd $1 "mi-dbg" "MIMALLOC_VERBOSE=1 MIMALLOC_STATS=1 ${ldpreload}=$alloc_lib" "$2" $i;; mi2-dbg) run_test_env_cmd $1 "mi2-dbg" "MIMALLOC_VERBOSE=1 MIMALLOC_STATS=1 ${ldpreload}=$alloc_lib" "$2" $i;; + mi3-dbg) run_test_env_cmd $1 "mi3-dbg" "MIMALLOC_VERBOSE=1 MIMALLOC_STATS=1 ${ldpreload}=$alloc_lib" "$2" $i;; tbb) run_test_env_cmd $1 "tbb" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_tbb_dir ${ldpreload}=$alloc_lib" "$2" $i;; *) run_test_env_cmd $1 "$alloc" "${ldpreload}=$alloc_lib" "$2" $i;; esac diff --git a/build-bench-env.sh b/build-bench-env.sh index 196f8745..e3ec5421 100755 --- a/build-bench-env.sh +++ b/build-bench-env.sh @@ -51,6 +51,7 @@ readonly version_lt=master # ~unmaintained since 2019 readonly version_mesh=master # ~unmaintained since 2021 readonly version_mi=v1.8.2 readonly version_mi2=v2.1.2 +readonly version_mi3=v3.3.0 readonly version_mng=master # ~unmaintained readonly version_nomesh=$version_mesh readonly version_pa=main @@ -92,6 +93,7 @@ setup_lt=0 setup_mesh=0 setup_mi=0 setup_mi2=0 +setup_mi3=0 setup_mng=0 setup_nomesh=0 setup_pa=0 @@ -143,6 +145,7 @@ while : ; do setup_lp=$flag_arg setup_mi=$flag_arg setup_mi2=$flag_arg + setup_mi3=$flag_arg setup_pa=$flag_arg setup_sn=$flag_arg setup_sg=$flag_arg @@ -213,6 +216,8 @@ while : ; do setup_mi=$flag_arg;; mi2) setup_mi2=$flag_arg;; + mi3) + setup_mi3=$flag_arg;; nomesh) setup_nomesh=$flag_arg;; pa) @@ -272,6 +277,7 @@ while : ; do echo " mesh setup mesh allocator ($version_mesh)" echo " mi setup mimalloc ($version_mi)" echo " mi2 setup mimalloc ($version_mi2)" + echo " mi3 setup mimalloc ($version_mi3)" echo " mng setup mallocng ($version_mng)" echo " nomesh setup mesh allocator w/o meshing ($version_mesh)" echo " pa setup PartitionAlloc ($version_pa)" @@ -763,6 +769,29 @@ if test "$setup_mi2" = "1"; then popd fi +if test "$setup_mi3" = "1"; then + checkout mi3 $version_mi3 https://github.com/microsoft/mimalloc + + echo "" + echo "- build mimalloc3 release" + + cmake -B out/release + cmake --build out/release --parallel $procs + + echo "" + echo "- build mimalloc3 debug with full checking" + + cmake -B out/debug -DMI_CHECK_FULL=ON + cmake --build out/debug --parallel $procs + + echo "" + echo "- build mimalloc3 secure" + + cmake -B out/secure -DMI_SECURE=ON + cmake --build out/secure --parallel $procs + popd +fi + if test "$setup_yal" = "1"; then checkout yal $version_yal https://github.com/jorisgeer/yalloc ./build.sh -V