vey-mimalloc-sys 0.3.2+3.7.0

Rust FFI binding to mimalloc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
on:
  workflow_dispatch:   # allow running the workflow manually
  push:
    branches:
      - 'dev*'
    tags:
      - 'v*'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true # Cancel any in-progress runs of this workflow when a new run is triggered on the same ref (branch or tag)

name: Test
permissions:
  contents: read

env:
  MIMALLOC_SHOW_ERRORS: 1

defaults:
  run:
    shell: bash   # also on Windows (git bash)

# Each test step configures, builds, and tests `out/<dir>` using:
#   sh .github/ci/cmake-test.sh <dir> <build-type> [cmake-args ...]
# (see the script for the `CI_*` environment variables)
jobs:
  basic:
    name: basic, ${{ matrix.os }}, ${{ matrix.lang }}
    runs-on: ${{ matrix.os }}
    env:
      CI_CMAKE_ARGS: ${{ matrix.lang_args }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest, macos-15, macos-15-intel, ubuntu-22.04-arm, windows-11-arm]
        lang: [c, cxx]
        include:
          - lang: c
            lang_args: -DMI_USE_CXX=OFF
          - lang: cxx
            lang_args: -DMI_USE_CXX=ON
          - os: windows-latest  # use C++20 with MSVC so `mi_likely`/`mi_unlikely` expand to `[[likely]]`/`[[unlikely]]` (which are only valid in an `if` condition)
            lang: cxx
            lang_args: -DMI_USE_CXX=ON -DCMAKE_CXX_STANDARD=20
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Release
        run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON

      - name: Release, Asm
        if: runner.os == 'Linux' && matrix.lang == 'c'
        uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
        with:
          name: ${{ matrix.os }}-${{ matrix.lang }}-asm
          path: out/release/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL

      - name: Secure
        run: sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON

      - name: Release, PAC weak
        if: runner.os == 'Linux' && runner.arch == 'X64' && matrix.lang == 'c'
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-pac-weak Release -DMI_PAC=WEAK

      - name: Debug, Win32
        if: runner.os == 'Windows'
        run: sh .github/ci/cmake-test.sh debug-x86 Debug -A Win32

      - name: Release, Win32
        if: runner.os == 'Windows'
        run: sh .github/ci/cmake-test.sh release-x86 Release -A Win32

      # Native MTE build on the arm64 runner (test-mte is skipped if the hardware has no MTE)
      - name: Release, MTE prefer, PAC
        if: matrix.os == 'ubuntu-22.04-arm' && matrix.lang == 'c'
        run: |
          if grep -qw mte /proc/cpuinfo; then echo "::notice::native MTE is available"; else echo "::notice::native MTE is not available"; fi
          if grep -qw pacg /proc/cpuinfo; then echo "::notice::native PAC is available"; else echo "::notice::native PAC is not available"; fi
          sh .github/ci/cmake-test.sh release-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=PREFER -DMI_PAC=ON

  extra-linux:
    name: extra, ${{ matrix.os }}, c
    runs-on: ${{ matrix.os }}
    env:
      CI_PARALLEL: 8
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, ubuntu-22.04-arm]
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Release, SIMD
        run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON

      - name: Debug, TLS pthreads
        run: sh .github/ci/cmake-test.sh debug-tls-pthreads Debug -DMI_TLS_MODEL_PTHREADS=ON

      - name: Release, TLS pthreads
        run: sh .github/ci/cmake-test.sh release-tls-pthreads Release -DMI_TLS_MODEL_PTHREADS=ON -DMI_SEE_ASM=ON

      - name: Debug, C++, clang++
        run: CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-clang-cxx Debug -DMI_DEBUG=FULL -DMI_USE_CXX=ON

      - name: Release, C++, clang++
        run: CC=clang CXX=clang++ sh .github/ci/cmake-test.sh release-clang-cxx Release -DMI_OPT_ARCH=ON -DMI_USE_CXX=ON -DMI_SEE_ASM=ON

      - name: Release, C++, clang++, Asm
        uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
        with:
          name: ${{ matrix.os }}-clang-cxx-asm
          path: out/release-clang-cxx/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Debug, ASAN
        run: MI_TEST_LIGHT=1 CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-asan Debug -DMI_DEBUG=FULL -DMI_TRACK=ASAN

      - name: Debug, UBSAN
        run: MI_TEST_LIGHT=1 CC=clang CXX=clang++ sh .github/ci/cmake-test.sh debug-ubsan-cxx Debug -DMI_DEBUG=FULL -DMI_DEBUG_UBSAN=ON

      - name: Debug, Guarded
        run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=1024 sh .github/ci/cmake-test.sh debug-guarded Debug -DMI_DEBUG=FULL -DMI_GUARDED=FULL

      - name: Debug, Secure Full
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-full Debug -DMI_DEBUG=FULL -DMI_SECURE=FULL

      - name: Release, Secure Full
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-full Release -DMI_OPT_ARCH=ON -DMI_SECURE=FULL

      - name: Release, Secure, PAC weak
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-pac-weak Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON -DMI_PAC=WEAK

      - name: Debug, Secure, PAC weak
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-pac-weak Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_PAC=WEAK

      - name: Release, Guarded
        if: startsWith(github.ref_name,'dev3')
        run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=128 sh .github/ci/cmake-test.sh release-guarded Release -DMI_OPT_ARCH=ON -DMI_GUARDED=FULL

      - name: Debug, Use pagemap
        if: startsWith(github.ref_name,'dev3')
        run: sh .github/ci/cmake-test.sh debug-pagemap Debug -DMI_DEBUG=FULL -DMI_FREE_USE_PAGEMAP=ON

      - name: Release, Use pagemap
        if: startsWith(github.ref_name,'dev3')
        run: sh .github/ci/cmake-test.sh release-pagemap Release -DMI_OPT_ARCH=ON -DMI_FREE_USE_PAGEMAP=ON

  extra-windows:
    name: extra, ${{ matrix.os }}, c
    runs-on: ${{ matrix.os }}
    env:
      CI_PARALLEL: 8
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, windows-11-arm]
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Release, SIMD
        run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON

      - name: Debug, Guarded
        run: MI_TEST_LIGHT=1 MIMALLOC_GUARDED_SAMPLE_RATE=1024 sh .github/ci/cmake-test.sh debug-guarded Debug -DMI_DEBUG=FULL -DMI_GUARDED=FULL

      - name: Debug, Secure Full
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-full Debug -DMI_DEBUG=FULL -DMI_SECURE=FULL

      - name: Release, Secure Full
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-full Release -DMI_OPT_ARCH=ON -DMI_SECURE=FULL

      - name: Release, Secure, PAC weak
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh release-secure-pac-weak Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON -DMI_PAC=WEAK

      - name: Debug, Secure, PAC weak
        run: MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh debug-secure-pac-weak Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_PAC=WEAK

  extra-macos:
    name: extra, ${{ matrix.os }}, c
    runs-on: ${{ matrix.os }}
    env:
      CI_PARALLEL: 8
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, macos-15-intel]
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Release, SIMD
        run: sh .github/ci/cmake-test.sh release-simd Release -DMI_OPT_ARCH=ON -DMI_OPT_SIMD=ON

      - name: Debug, TLS fixed
        run: sh .github/ci/cmake-test.sh debug-tls-fixed Debug -DMI_TLS_MODEL_FIXED=ON

      - name: Release, TLS fixed
        run: sh .github/ci/cmake-test.sh release-tls-fixed Release -DMI_TLS_MODEL_FIXED=ON

      # MTE on macOS/arm64 (only actually supported on M5 and later)
      - name: Debug, MTE prefer
        if: runner.arch == 'ARM64'
        run: sh .github/ci/cmake-test.sh debug-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER

      - name: Release, MTE prefer, PAC
        if: runner.arch == 'ARM64'
        run: sh .github/ci/cmake-test.sh release-mte Release -DMI_MTE=PREFER -DMI_PAC=ON

      - name: Debug, Secure, MTE prefer
        if: runner.arch == 'ARM64'
        run: sh .github/ci/cmake-test.sh debug-secure-mte Debug -DMI_DEBUG=FULL -DMI_SECURE=ON -DMI_MTE=PREFER

      - name: Release, Secure, MTE prefer, PAC
        if: runner.arch == 'ARM64'
        run: sh .github/ci/cmake-test.sh release-secure-mte Release -DMI_SECURE=ON -DMI_MTE=PREFER -DMI_PAC=ON

  # Windows: clang-cl and clang
  windows-clang:
    name: clang, ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, windows-11-arm]
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Debug, Win32, clang-cl
        run: sh .github/ci/cmake-test.sh debug-x86-clang-cl Debug -A Win32 -T ClangCl

      - name: Release, Win32, clang-cl
        run: sh .github/ci/cmake-test.sh release-x86-clang-cl Release -A Win32 -T ClangCl

      - name: Debug, clang-cl
        run: sh .github/ci/cmake-test.sh debug-clang-cl Debug -T ClangCl

      - name: Release, clang-cl
        run: sh .github/ci/cmake-test.sh release-clang-cl Release -T ClangCl

      - name: Debug, clang
        run: sh .github/ci/cmake-test.sh debug-clang Debug -DCMAKE_C_COMPILER=clang

      - name: Release, clang
        run: sh .github/ci/cmake-test.sh release-clang Release -DCMAKE_C_COMPILER=clang

  # VM: FreeBSD (for arm64 (slow), use `arch: arm64` and `MI_TEST_LIGHT=1`)
  freebsd:
    name: qemu, freebsd-x64
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: freebsd {0}
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1.5.9
        with:
          arch: x86_64
          usesh: true
          custom-shell-name: freebsd
          cache-after-prepare: true
          prepare: |
            pkg install -y cmake

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL

      - name: Release
        run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON

      - name: Secure
        run: sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON

  # VM: Alpine Linux with MUSL libc
  alpine:
    name: qemu, alpine-${{ matrix.target }}
    runs-on: ubuntu-24.04   # setup-alpine uses `sudo -E` which is not supported by sudo-rs on Ubuntu 26.04+
    continue-on-error: true
    defaults:
      run:
        shell: alpine.sh {0}
    env:
      CI_CMAKE_ARGS: ${{ matrix.cmake_args }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x64
            arch: x86_64
          - target: riscv64
            arch: riscv64
            packages: ninja clang
            apk_tools_url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v3.0.7/x86_64/apk.static#!sha256!c07bf5356eacc9dd7a8c56bc537f46702f007170287403299d52a04264e74b3c
            cmake_args: -G Ninja
            test_env: MI_TEST_LIGHT=2
          - target: arm32
            arch: armv7  # or armhf for arm-v6 with hard float
            test_env: MI_TEST_LIGHT=2
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
        with:
          arch: ${{ matrix.arch }}
          # (the default of the action is used if `apk_tools_url` is not set)
          apk-tools-url: ${{ matrix.apk_tools_url || 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/x86_64/apk.static#!sha256!34bb1a96f0258982377a289392d4ea9f3f4b767a4bb5806b1b87179b79ad8a1c' }}
          packages: build-base cmake ${{ matrix.packages }}

      - name: Release, clang
        if: matrix.target == 'riscv64'
        run: ${{ matrix.test_env }} CC=clang CXX=clang++ sh .github/ci/cmake-test.sh release-clang Release -DMI_OPT_ARCH=rv64gcb_zacas_zalasr -DMI_SEE_ASM=ON

      - name: Release, clang, Asm
        if: matrix.target == 'riscv64'
        uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
        with:
          name: alpine-${{ matrix.target }}-clang-asm
          path: out/release-clang/CMakeFiles/mimalloc-static.dir/src/*.s

      - name: Release
        if: matrix.target != 'riscv64' && matrix.target != 'arm32'  # (building under emulation is slow)
        run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON -DMI_SEE_ASM=ON

      - name: Debug
        run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL

      - name: Secure
        if: matrix.target != 'riscv64'
        run: ${{ matrix.test_env }} sh .github/ci/cmake-test.sh secure Release -DMI_SECURE=ON

  # Linux arm64 with memory tagging (MTE) emulated by QEMU (`-cpu max` as QEMU user mode faults on `dc zva` with tagged pointers, which glibc and bionic use in `memset` on `neoverse-n2`)
  # (test-fork is excluded under QEMU as QEMU 8.2 user mode can deadlock when forking with threads, also without MTE)
  linux-arm64-mte:
    name: qemu, linux-arm64-mte
    runs-on: ubuntu-latest
    env:
      QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
      QEMU_CPU: max
      MI_TEST_LIGHT: 1
      MI_TEST_REQUIRE_MTE: 1
      CI_CMAKE_ARGS: -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64
      CI_CTEST_ARGS: -E test-fork
      CI_CTEST_TIMEOUT: 600
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        run: |
          sudo apt-get update -q
          sudo apt-get install -y -q gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
          qemu-aarch64 --version
          ls /proc/sys/fs/binfmt_misc/ | grep aarch64 || echo "no binfmt registration for aarch64"

      - name: Release, MTE, PAC
        run: sh .github/ci/cmake-test.sh release-arm64-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON

      - name: Release, MTE, PAC, verbose test-mte
        run: MIMALLOC_VERBOSE=1 qemu-aarch64 out/release-arm64-mte/mimalloc-test-mte

      - name: Release, Async, MTE, PAC
        run: MIMALLOC_MTE=async sh .github/ci/cmake-test.sh release-arm64-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON

      - name: Debug, MTE
        run: sh .github/ci/cmake-test.sh debug-arm64-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER

  # Android arm64: cross-built with the preinstalled NDK as static executables (bionic) and run with QEMU (`-cpu max` emulates MTE).
  # (test-fork is excluded as QEMU 8.2 user mode can deadlock when forking with threads)
  # No malloc override: since NDK r30 the static bionic startup code always links in bionic's own `malloc`.
  android-arm64:
    name: qemu, android-arm64
    runs-on: ubuntu-latest
    env:
      QEMU_CPU: max
      MI_TEST_LIGHT: 1
      CI_CTEST_ARGS: -E test-fork
      CI_CTEST_TIMEOUT: 600
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        run: |
          sudo apt-get update -q
          sudo apt-get install -y -q qemu-user
          qemu-aarch64 --version
          NDK="${ANDROID_NDK_LATEST_HOME:-$ANDROID_NDK_HOME}"
          test -f "$NDK/build/cmake/android.toolchain.cmake" || { echo "::error::Android NDK not found"; exit 1; }
          echo "NDK: $NDK"
          echo "CI_CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-30 -DANDROID_STL=c++_static -DMI_BUILD_SHARED=OFF -DMI_OVERRIDE=OFF -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64" >> $GITHUB_ENV

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug-android Debug -DMI_DEBUG=FULL

      - name: Release
        run: sh .github/ci/cmake-test.sh release-android Release -DMI_OPT_ARCH=ON

      - name: Secure
        run: sh .github/ci/cmake-test.sh secure-android Release -DMI_OPT_ARCH=ON -DMI_SECURE=ON

      - name: Debug, MTE prefer
        run: MI_TEST_REQUIRE_MTE=1 sh .github/ci/cmake-test.sh debug-android-mte Debug -DMI_DEBUG=FULL -DMI_MTE=PREFER

      - name: Release, MTE, PAC
        run: MI_TEST_REQUIRE_MTE=1 sh .github/ci/cmake-test.sh release-android-mte Release -DMI_OPT_ARCH=ON -DMI_MTE=ON -DMI_PAC=ON

      - name: Release, MTE, PAC, verbose test-mte
        run: MIMALLOC_VERBOSE=1 qemu-aarch64 out/release-android-mte/mimalloc-test-mte

  # TSAN
  tsan:
    name: tsan, ubuntu-latest
    runs-on: ubuntu-latest
    env:
      CC: clang
      CXX: clang++
      CI_PARALLEL: 8
      CI_CTEST_TIMEOUT: 360
      # MI_TEST_LIGHT: 1
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Debug, TSAN
        run: sh .github/ci/cmake-test.sh debug-tsan Debug -DMI_DEBUG=FULL -DMI_DEBUG_TSAN=ON

  # CHERI simulation (see test/cheri-sim.h)
  cheri-sim:
    name: cheri-sim, ubuntu-latest
    runs-on: ubuntu-latest
    env:
      CC: clang
      CFLAGS: -include ${{ github.workspace }}/test/cheri-sim.h -Wno-builtin-macro-redefined -U__SIZEOF_POINTER__ -D__SIZEOF_POINTER__=16
      CI_CMAKE_ARGS: -DMI_BUILD_SHARED=OFF
      CI_CTEST_ARGS: -E ^test-rust$
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Release
        run: sh .github/ci/cmake-test.sh release-cheri-sim Release

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug-cheri-sim Debug -DMI_DEBUG=FULL

      - name: Guarded
        run: |
          MI_TEST_LIGHT=1 sh .github/ci/cmake-test.sh guarded-cheri-sim Release -DMI_GUARDED=ON
          MIMALLOC_GUARDED_SAMPLE_RATE=1 out/guarded-cheri-sim/mimalloc-test-api

  # Emscripten (tests run on node)
  emscripten:
    name: emscripten
    runs-on: ubuntu-latest
    env:
      CI_CMAKE: emcmake cmake
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        uses: mymindstorm/setup-emsdk@4528d102f7230f0e7b276855c01ea1159be0e984 # v16

      - name: Release
        run: sh .github/ci/cmake-test.sh release-wasm Release -DCMAKE_C_FLAGS=-pthread

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug-wasm Debug -DMI_DEBUG=FULL -DCMAKE_C_FLAGS=-pthread

      - name: Single threaded
        run: sh .github/ci/cmake-test.sh single-wasm Release

  # MSYS2
  mingw:
    name: mingw-${{ matrix.target }}
    runs-on: windows-latest
    defaults:
      run:
        shell: msys2 {0}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: ucrt64
            msystem: UCRT64
            cc: gcc
          - target: mingw64
            msystem: MINGW64    # gcc + msvcrt
            cc: gcc
          - target: clang64
            msystem: CLANG64    # clang + ucrt
            cc: clang
    steps:
      - name: Checkout repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup
        uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2.33.0
        with:
          msystem: ${{ matrix.msystem }}
          suppress-deprecation-warnings: msystem-mingw64   # keep testing gcc + msvcrt
          pacboy: ${{ matrix.cc }}:p git:p make:p cmake:p

      - name: Debug
        run: sh .github/ci/cmake-test.sh debug Debug -DMI_DEBUG=FULL

      - name: Release
        if: matrix.target == 'ucrt64'
        run: sh .github/ci/cmake-test.sh release Release -DMI_OPT_ARCH=ON