From fc9c2915c74ac120a9b52c9003f768a9a4e30a55 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 14 Nov 2019 11:47:18 -0500 Subject: Even if jemalloc feature is used do not use it on msvc Fixes #2233 --- crates/ra_prof/Cargo.toml | 36 +++++++++++++++++++----------------- crates/ra_prof/src/lib.rs | 2 +- crates/ra_prof/src/memory_usage.rs | 4 ++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/crates/ra_prof/Cargo.toml b/crates/ra_prof/Cargo.toml index 7db4498c3..bb241258c 100644 --- a/crates/ra_prof/Cargo.toml +++ b/crates/ra_prof/Cargo.toml @@ -1,17 +1,19 @@ -[package] -edition = "2018" -name = "ra_prof" -version = "0.1.0" -authors = ["rust-analyzer developers"] -publish = false - -[dependencies] -once_cell = "1.0.1" -itertools = "0.8.0" -backtrace = "0.3.28" -jemallocator = { version = "0.3.2", optional = true } -jemalloc-ctl = { version = "0.3.2", optional = true } - -[features] -jemalloc = [ "jemallocator", "jemalloc-ctl" ] -cpu_profiler = [] +[package] +edition = "2018" +name = "ra_prof" +version = "0.1.0" +authors = ["rust-analyzer developers"] +publish = false + +[dependencies] +once_cell = "1.0.1" +itertools = "0.8.0" +backtrace = "0.3.28" + +[target.'cfg(not(target_env = "msvc"))'.dependencies] +jemallocator = { version = "0.3.2", optional = true } +jemalloc-ctl = { version = "0.3.2", optional = true } + +[features] +jemalloc = [ "jemallocator", "jemalloc-ctl" ] +cpu_profiler = [] diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index e5385f51b..845b2221c 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -24,7 +24,7 @@ pub use crate::memory_usage::{Bytes, MemoryUsage}; // We use jemalloc mainly to get heap usage statistics, actual performance // difference is not measures. -#[cfg(feature = "jemalloc")] +#[cfg(all(feature = "jemalloc", not(target_env = "msvc")))] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; diff --git a/crates/ra_prof/src/memory_usage.rs b/crates/ra_prof/src/memory_usage.rs index ad005ea14..9768f656c 100644 --- a/crates/ra_prof/src/memory_usage.rs +++ b/crates/ra_prof/src/memory_usage.rs @@ -8,7 +8,7 @@ pub struct MemoryUsage { } impl MemoryUsage { - #[cfg(feature = "jemalloc")] + #[cfg(all(feature = "jemalloc", not(target_env = "msvc")))] pub fn current() -> MemoryUsage { jemalloc_ctl::epoch::advance().unwrap(); MemoryUsage { @@ -17,7 +17,7 @@ impl MemoryUsage { } } - #[cfg(not(feature = "jemalloc"))] + #[cfg(any(not(feature = "jemalloc"), target_env = "msvc"))] pub fn current() -> MemoryUsage { MemoryUsage { allocated: Bytes(0), resident: Bytes(0) } } -- cgit v1.2.3