Skip to content

Commit 3482094

Browse files
committed
Use mimalloc as global_allocator for rustc_driver
1 parent d5cdb9e commit 3482094

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Cargo.lock

+20
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,16 @@ version = "0.2.8"
22022202
source = "registry+https://github.com/rust-lang/crates.io-index"
22032203
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
22042204

2205+
[[package]]
2206+
name = "libmimalloc-sys"
2207+
version = "0.1.35"
2208+
source = "registry+https://github.com/rust-lang/crates.io-index"
2209+
checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664"
2210+
dependencies = [
2211+
"cc",
2212+
"libc",
2213+
]
2214+
22052215
[[package]]
22062216
name = "libredox"
22072217
version = "0.0.1"
@@ -2407,6 +2417,15 @@ dependencies = [
24072417
"autocfg",
24082418
]
24092419

2420+
[[package]]
2421+
name = "mimalloc"
2422+
version = "0.1.39"
2423+
source = "registry+https://github.com/rust-lang/crates.io-index"
2424+
checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c"
2425+
dependencies = [
2426+
"libmimalloc-sys",
2427+
]
2428+
24102429
[[package]]
24112430
name = "mime"
24122431
version = "0.3.17"
@@ -3737,6 +3756,7 @@ dependencies = [
37373756
name = "rustc_driver"
37383757
version = "0.0.0"
37393758
dependencies = [
3759+
"mimalloc",
37403760
"rustc_driver_impl",
37413761
]
37423762

compiler/rustc_driver/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# tidy-alphabetical-start
11+
mimalloc = "0.1.39"
1112
rustc_driver_impl = { path = "../rustc_driver_impl" }
1213
# tidy-alphabetical-end

compiler/rustc_driver/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
#![feature(rustdoc_internals)]
66
#![doc(rust_logo)]
77

8+
#[global_allocator]
9+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
10+
811
pub use rustc_driver_impl::*;

src/tools/tidy/src/deps.rs

+2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
270270
"leb128",
271271
"libc",
272272
"libloading",
273+
"libmimalloc-sys",
273274
"linux-raw-sys",
274275
"litemap",
275276
"lock_api",
@@ -280,6 +281,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
280281
"memchr",
281282
"memmap2",
282283
"memoffset",
284+
"mimalloc",
283285
"miniz_oxide",
284286
"nu-ansi-term",
285287
"num-conv",

0 commit comments

Comments
 (0)