Skip to content

Commit

Permalink
Use mimalloc as global_allocator for rustc_driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 12, 2024
1 parent d5cdb9e commit 3482094
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,16 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"

[[package]]
name = "libmimalloc-sys"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664"
dependencies = [
"cc",
"libc",
]

[[package]]
name = "libredox"
version = "0.0.1"
Expand Down Expand Up @@ -2407,6 +2417,15 @@ dependencies = [
"autocfg",
]

[[package]]
name = "mimalloc"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c"
dependencies = [
"libmimalloc-sys",
]

[[package]]
name = "mime"
version = "0.3.17"
Expand Down Expand Up @@ -3737,6 +3756,7 @@ dependencies = [
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"mimalloc",
"rustc_driver_impl",
]

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ crate-type = ["dylib"]

[dependencies]
# tidy-alphabetical-start
mimalloc = "0.1.39"
rustc_driver_impl = { path = "../rustc_driver_impl" }
# tidy-alphabetical-end
3 changes: 3 additions & 0 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
#![feature(rustdoc_internals)]
#![doc(rust_logo)]

#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

pub use rustc_driver_impl::*;
2 changes: 2 additions & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"leb128",
"libc",
"libloading",
"libmimalloc-sys",
"linux-raw-sys",
"litemap",
"lock_api",
Expand All @@ -280,6 +281,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"memchr",
"memmap2",
"memoffset",
"mimalloc",
"miniz_oxide",
"nu-ansi-term",
"num-conv",
Expand Down

0 comments on commit 3482094

Please sign in to comment.