Skip to content

Commit bbb022d

Browse files
bors[bot]kjeremy
andauthored
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]>
2 parents f2c64ba + fc9c291 commit bbb022d

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

crates/ra_prof/Cargo.toml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
[package]
2-
edition = "2018"
3-
name = "ra_prof"
4-
version = "0.1.0"
5-
authors = ["rust-analyzer developers"]
6-
publish = false
7-
8-
[dependencies]
9-
once_cell = "1.0.1"
10-
itertools = "0.8.0"
11-
backtrace = "0.3.28"
12-
jemallocator = { version = "0.3.2", optional = true }
13-
jemalloc-ctl = { version = "0.3.2", optional = true }
14-
15-
[features]
16-
jemalloc = [ "jemallocator", "jemalloc-ctl" ]
17-
cpu_profiler = []
1+
[package]
2+
edition = "2018"
3+
name = "ra_prof"
4+
version = "0.1.0"
5+
authors = ["rust-analyzer developers"]
6+
publish = false
7+
8+
[dependencies]
9+
once_cell = "1.0.1"
10+
itertools = "0.8.0"
11+
backtrace = "0.3.28"
12+
13+
[target.'cfg(not(target_env = "msvc"))'.dependencies]
14+
jemallocator = { version = "0.3.2", optional = true }
15+
jemalloc-ctl = { version = "0.3.2", optional = true }
16+
17+
[features]
18+
jemalloc = [ "jemallocator", "jemalloc-ctl" ]
19+
cpu_profiler = []

crates/ra_prof/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub use crate::memory_usage::{Bytes, MemoryUsage};
2424

2525
// We use jemalloc mainly to get heap usage statistics, actual performance
2626
// difference is not measures.
27-
#[cfg(feature = "jemalloc")]
27+
#[cfg(all(feature = "jemalloc", not(target_env = "msvc")))]
2828
#[global_allocator]
2929
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
3030

crates/ra_prof/src/memory_usage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct MemoryUsage {
88
}
99

1010
impl MemoryUsage {
11-
#[cfg(feature = "jemalloc")]
11+
#[cfg(all(feature = "jemalloc", not(target_env = "msvc")))]
1212
pub fn current() -> MemoryUsage {
1313
jemalloc_ctl::epoch::advance().unwrap();
1414
MemoryUsage {
@@ -17,7 +17,7 @@ impl MemoryUsage {
1717
}
1818
}
1919

20-
#[cfg(not(feature = "jemalloc"))]
20+
#[cfg(any(not(feature = "jemalloc"), target_env = "msvc"))]
2121
pub fn current() -> MemoryUsage {
2222
MemoryUsage { allocated: Bytes(0), resident: Bytes(0) }
2323
}

0 commit comments

Comments
 (0)