mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
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 <kjeremy@gmail.com>
This commit is contained in:
commit
bbb022d399
3 changed files with 22 additions and 20 deletions
|
@ -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 = []
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue