opt-in jemalloc

This commit is contained in:
Aleksey Kladov 2019-01-28 15:52:21 +03:00
parent 3432c4366f
commit 2ee08098a6
5 changed files with 23 additions and 3 deletions

View file

@ -133,6 +133,7 @@ struct MemoryStats {
}
impl MemoryStats {
#[cfg(feature = "jemalloc")]
fn current() -> MemoryStats {
jemalloc_ctl::epoch().unwrap();
MemoryStats {
@ -140,6 +141,14 @@ impl MemoryStats {
resident: Bytes(jemalloc_ctl::stats::resident().unwrap()),
}
}
#[cfg(not(feature = "jemalloc"))]
fn current() -> MemoryStats {
MemoryStats {
allocated: Bytes(0),
resident: Bytes(0),
}
}
}
impl fmt::Display for MemoryStats {