concinnity_memory::install_global_allocator!();
fn main() -> std::io::Result<()> {
concinnity_cli::run()
}
#[cfg(test)]
mod tests {
#[test]
fn the_dev_cli_tracks_its_own_heap() {
const MIB: usize = 1 << 20;
let before = concinnity_memory::stats()
.expect("this binary declares the tracking allocator")
.alloc_count;
let held: Vec<u8> = core::hint::black_box(vec![0; MIB]);
let after = concinnity_memory::stats().expect("the allocator stays installed");
assert!(
after.alloc_count > before,
"allocation count did not move ({before} -> {}) across a megabyte",
after.alloc_count
);
assert!(after.peak_bytes >= after.live_bytes);
drop(core::hint::black_box(held));
}
}