jemallocator 0.3

This commit is contained in:
Jeremy A. Kolb 2019-07-17 10:58:17 -04:00
parent c7ceea82a5
commit 5e9198f809
3 changed files with 49 additions and 15 deletions

View file

@ -8,10 +8,10 @@ pub struct MemoryUsage {
impl MemoryUsage {
#[cfg(feature = "jemalloc")]
pub fn current() -> MemoryUsage {
jemalloc_ctl::epoch().unwrap();
jemalloc_ctl::epoch::advance().unwrap();
MemoryUsage {
allocated: Bytes(jemalloc_ctl::stats::allocated().unwrap()),
resident: Bytes(jemalloc_ctl::stats::resident().unwrap()),
allocated: Bytes(jemalloc_ctl::stats::allocated::read().unwrap()),
resident: Bytes(jemalloc_ctl::stats::resident::read().unwrap()),
}
}