Skip to content

Commit ad947a6

Browse files
committed
perf: use mimalloc for musl build
1 parent 48aa3b9 commit ad947a6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

crates/rspack_allocator/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ version = "0.1.0"
1111
[target.'cfg(not(target_os = "linux"))'.dependencies]
1212
mimalloc-rust = { workspace = true }
1313

14+
[target.'cfg(all(target_os = "linux", target_env = "musl"))'.dependencies]
15+
mimalloc-rust = { workspace = true }
16+
1417
[target.'cfg(all(target_os = "linux", target_env = "gnu", any(target_arch = "x86_64", target_arch = "aarch64")))'.dependencies]
1518
tikv-jemallocator = { workspace = true }

crates/rspack_allocator/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#[global_allocator]
33
static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc;
44

5+
#[cfg(all(target_os = "linux", target_env = "musl",))]
6+
#[global_allocator]
7+
static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc;
8+
59
#[cfg(all(
610
target_os = "linux",
711
target_env = "gnu",

0 commit comments

Comments
 (0)