handle the case where 0 or >1 allocs are enabled
In particular this fixes `cargo build --all-features`.
This commit is contained in:
parent
e0c0d51a05
commit
3b05417246
5 changed files with 29 additions and 24 deletions
|
@ -1,6 +1,3 @@
|
|||
#![cfg(all(not(target_env = "msvc"), feature = "jemalloc", not(feature = "hardened_malloc")))]
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::ffi::{c_char, c_void};
|
||||
|
||||
use tikv_jemalloc_ctl as mallctl;
|
||||
|
@ -10,8 +7,6 @@ use tikv_jemallocator as jemalloc;
|
|||
#[global_allocator]
|
||||
static JEMALLOC: jemalloc::Jemalloc = jemalloc::Jemalloc;
|
||||
|
||||
pub(crate) fn version() -> &'static str { mallctl::version::read().expect("version string") }
|
||||
|
||||
pub(crate) fn memory_usage() -> String {
|
||||
use mallctl::stats;
|
||||
let allocated = stats::allocated::read().unwrap_or_default() as f64 / 1024.0 / 1024.0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue