Skip to content

Commit db69100

Browse files
committed
feat: add mimalloc v3
1 parent 77d3439 commit db69100

File tree

9 files changed

+34
-4
lines changed

9 files changed

+34
-4
lines changed
File renamed without changes.

.github/workflows/ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Test libmimalloc-sys crate bindings (secure)
4646
run: cargo run --features secure -p libmimalloc-sys-test
4747

48+
- name: Test libmimalloc-sys crate bindings (v3)
49+
run: cargo run --features v3 -p libmimalloc-sys-test
50+
4851
- name: Build (no secure)
4952
run: cargo build
5053

@@ -60,6 +63,12 @@ jobs:
6063
- name: Test (extended)
6164
run: cargo test --features extended
6265

66+
- name: Test (v3)
67+
run: cargo test --features v3
68+
69+
- name: Test (extended, v3)
70+
run: cargo test --features extended,v3
71+
6372
- name: Test libmimalloc-sys crate bindings (extended)
6473
run: cargo run --features extended -p libmimalloc-sys-test
6574

@@ -153,7 +162,7 @@ jobs:
153162
- uses: goto-bus-stop/setup-zig@v2
154163
if: ${{ contains(matrix.settings.target, 'musl') }}
155164
with:
156-
version: 0.14.1
165+
version: 0.15.2
157166

158167
- name: Install cargo-zigbuild
159168
uses: taiki-e/install-action@v2
@@ -163,7 +172,7 @@ jobs:
163172
with:
164173
tool: cargo-zigbuild
165174

166-
- uses: actions/setup-node@v5
175+
- uses: actions/setup-node@v6
167176
with:
168177
node-version: 22
169178

@@ -187,19 +196,28 @@ jobs:
187196
if [[ "${{ matrix.settings.target }}" == *"musl"* ]]; then
188197
yarn build --target ${{ matrix.settings.target }} -x
189198
yarn build --target ${{ matrix.settings.target }} -x --release
199+
yarn build --target ${{ matrix.settings.target }} -x --features v3
200+
yarn build --target ${{ matrix.settings.target }} -x --features v3 --release
190201
elif [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then
191202
export TARGET_CFLAGS="-fuse-ld=lld"
192203
export TARGET_CC=clang
193204
yarn build --target ${{ matrix.settings.target }} --use-napi-cross
194205
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --release
206+
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3
207+
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3 --release
195208
elif [[ "${{ matrix.settings.target }}" == *"msvc"* ]]; then
196209
yarn build --target ${{ matrix.settings.target }}
197210
yarn build --target ${{ matrix.settings.target }} --release
211+
yarn build --target ${{ matrix.settings.target }} --features v3
212+
yarn build --target ${{ matrix.settings.target }} --features v3 --release
198213
mkdir -p .cargo
199214
echo "[target.${{ matrix.settings.target }}]" >> .cargo/config.toml
200215
echo "rustflags = [\"-C\", \"target-feature=+crt-static\"]" >> .cargo/config.toml
201216
yarn build --target ${{ matrix.settings.target }} --release
217+
yarn build --target ${{ matrix.settings.target }} --features v3 --release
202218
else
203219
yarn build --target ${{ matrix.settings.target }}
204220
yarn build --target ${{ matrix.settings.target }} --release
221+
yarn build --target ${{ matrix.settings.target }} --features v3
222+
yarn build --target ${{ matrix.settings.target }} --features v3 --release
205223
fi

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "libmimalloc-sys/c_src/mimalloc"]
22
path = libmimalloc-sys/c_src/mimalloc
33
url = https://github.com/microsoft/mimalloc.git
4+
[submodule "libmimalloc-sys/c_src/mimalloc3"]
5+
path = libmimalloc-sys/c_src/mimalloc3
6+
url = https://github.com/microsoft/mimalloc.git

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ no_thp = ["libmimalloc-sys2/no_thp"]
3434
no_opt_arch = ["libmimalloc-sys2/no_opt_arch"]
3535
extended = ["libmimalloc-sys2/extended"]
3636
skip_collect_on_exit = ["libmimalloc-sys2/skip_collect_on_exit"]
37-
3837
etw = ["libmimalloc-sys2/etw"]
38+
v3 = ["libmimalloc-sys2/v3"]

example/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ publish = false
77
[lib]
88
crate-type = ["cdylib", "lib"]
99

10+
[features]
11+
v3 = ["mimalloc-safe/v3"]
12+
1013
[dependencies]
1114
napi = "3"
1215
napi-derive = "3"

libmimalloc-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ no_thp = []
3838
skip_collect_on_exit = []
3939
# turn off `MI_OPT_ARCH`, default is `ON`
4040
no_opt_arch = []
41+
v3 = []
4142

4243
# Show `extended` on docs.rs since it's the full API surface.
4344
[package.metadata.docs.rs]

libmimalloc-sys/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use std::env;
44
use cmake::Config;
55

66
fn main() {
7+
#[cfg(not(feature = "v3"))]
78
let mut cmake_config = Config::new("c_src/mimalloc");
9+
#[cfg(feature = "v3")]
10+
let mut cmake_config = Config::new("c_src/mimalloc3");
811

912
let mut mimalloc_base_name = Cow::Borrowed("mimalloc");
1013

libmimalloc-sys/c_src/mimalloc3

Submodule mimalloc3 added at 7a2a411

libmimalloc-sys/sys-test/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
name = "libmimalloc-sys-test"
33
version = "0.1.0"
44
authors = ["Thom Chiovoloni <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
description = "Bindings test for libmimalloc-sys"
77
license = "MIT"
88
publish = false
99

1010
[features]
1111
secure = ["libmimalloc-sys2/secure"]
1212
extended = ["libmimalloc-sys2/extended"]
13+
v3 = ["libmimalloc-sys2/v3"]
1314

1415
[dependencies]
1516
libmimalloc-sys2 = { path = "..", features = ["extended"] }

0 commit comments

Comments
 (0)