aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-14 16:48:58 +0000
committerGitHub <[email protected]>2019-11-14 16:48:58 +0000
commitbbb022d3999b3038549ec6c309efb065231c896a (patch)
tree6fea34f9b60123fad4e5b01e843f19d25c280df1 /crates
parentf2c64ba15d3ef87f731f17d90c873383d5f3e432 (diff)
parentfc9c2915c74ac120a9b52c9003f768a9a4e30a55 (diff)
Merge #2245
2245: Even if jemalloc feature is used do not use it on msvc r=matklad a=kjeremy Fixes #2233 Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_prof/Cargo.toml36
-rw-r--r--crates/ra_prof/src/lib.rs2
-rw-r--r--crates/ra_prof/src/memory_usage.rs4
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 @@
1[package] 1[package]
2edition = "2018" 2edition = "2018"
3name = "ra_prof" 3name = "ra_prof"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6publish = false 6publish = false
7 7
8[dependencies] 8[dependencies]
9once_cell = "1.0.1" 9once_cell = "1.0.1"
10itertools = "0.8.0" 10itertools = "0.8.0"
11backtrace = "0.3.28" 11backtrace = "0.3.28"
12jemallocator = { version = "0.3.2", optional = true } 12
13jemalloc-ctl = { version = "0.3.2", optional = true } 13[target.'cfg(not(target_env = "msvc"))'.dependencies]
14 14jemallocator = { version = "0.3.2", optional = true }
15[features] 15jemalloc-ctl = { version = "0.3.2", optional = true }
16jemalloc = [ "jemallocator", "jemalloc-ctl" ] 16
17cpu_profiler = [] 17[features]
18jemalloc = [ "jemallocator", "jemalloc-ctl" ]
19cpu_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};
24 24
25// We use jemalloc mainly to get heap usage statistics, actual performance 25// We use jemalloc mainly to get heap usage statistics, actual performance
26// difference is not measures. 26// difference is not measures.
27#[cfg(feature = "jemalloc")] 27#[cfg(all(feature = "jemalloc", not(target_env = "msvc")))]
28#[global_allocator] 28#[global_allocator]
29static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; 29static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
30 30
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 {
8} 8}
9 9
10impl MemoryUsage { 10impl MemoryUsage {
11 #[cfg(feature = "jemalloc")] 11 #[cfg(all(feature = "jemalloc", not(target_env = "msvc")))]
12 pub fn current() -> MemoryUsage { 12 pub fn current() -> MemoryUsage {
13 jemalloc_ctl::epoch::advance().unwrap(); 13 jemalloc_ctl::epoch::advance().unwrap();
14 MemoryUsage { 14 MemoryUsage {
@@ -17,7 +17,7 @@ impl MemoryUsage {
17 } 17 }
18 } 18 }
19 19
20 #[cfg(not(feature = "jemalloc"))] 20 #[cfg(any(not(feature = "jemalloc"), target_env = "msvc"))]
21 pub fn current() -> MemoryUsage { 21 pub fn current() -> MemoryUsage {
22 MemoryUsage { allocated: Bytes(0), resident: Bytes(0) } 22 MemoryUsage { allocated: Bytes(0), resident: Bytes(0) }
23 } 23 }