#![cfg(all(unix, feature = "jemalloc"))]
use memory_budget::{JemallocStatsSource, SystemJemallocStats};
#[global_allocator]
static ALLOCATOR: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
#[test]
fn statistics_observe_live_allocations_from_the_linked_allocator() {
let source = SystemJemallocStats::new().expect("linked jemalloc must expose statistics");
let mut live = vec![42_u8; 1024 * 1024];
std::hint::black_box(&mut live);
let stats = source.read();
assert!(stats.allocated_bytes >= live.len() as u64);
}