From 6710856c1098f71168c47451af53bac9a33b49dd Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Tue, 14 Jul 2020 00:12:49 +0000 Subject: Add opt-in mimalloc feature --- crates/ra_prof/Cargo.toml | 2 ++ crates/ra_prof/src/lib.rs | 4 ++++ crates/rust-analyzer/Cargo.toml | 1 + 3 files changed, 7 insertions(+) (limited to 'crates') diff --git a/crates/ra_prof/Cargo.toml b/crates/ra_prof/Cargo.toml index eabfcebb0..3cd8481ea 100644 --- a/crates/ra_prof/Cargo.toml +++ b/crates/ra_prof/Cargo.toml @@ -12,6 +12,7 @@ doctest = false ra_arena = { path = "../ra_arena" } once_cell = "1.3.1" backtrace = { version = "0.3.44", optional = true } +mimalloc = { version = "0.1.19", default-features = false, optional = true } [target.'cfg(not(target_env = "msvc"))'.dependencies] jemallocator = { version = "0.3.2", optional = true } @@ -24,4 +25,5 @@ cpu_profiler = [] # Uncomment to enable for the whole crate graph # default = [ "backtrace" ] # default = [ "jemalloc" ] +# default = [ "mimalloc" ] # default = [ "cpu_profiler" ] diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 7163a8424..b54531b4e 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -19,6 +19,10 @@ pub use crate::{ #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(all(feature = "mimalloc"))] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + /// Prints backtrace to stderr, useful for debugging. #[cfg(feature = "backtrace")] pub fn print_backtrace() { diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index c02f72517..5074740cc 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -65,3 +65,4 @@ tt = { path = "../ra_tt", package = "ra_tt" } [features] jemalloc = [ "ra_prof/jemalloc" ] +mimalloc = [ "ra_prof/mimalloc" ] -- cgit v1.2.3