[][src]Macro checkers::verify

macro_rules! verify {
    ($state:expr) => { ... };
}

Verify the state of the allocator.

Note: this macro is used by default if the verify parameter is not specified in #[checkers::test].

Currently performs the following tests:

  • Checks that each allocation has an exact corresponding deallocation, and that it happened after the allocation it relates to.
  • That there are no overlapping frees / allocations.
  • That the thread-local timeline matches.

Examples

#[global_allocator]
static ALLOCATOR: checkers::Allocator = checkers::Allocator::system();

fn verify_test_custom_verify(state: &mut checkers::State) {
   assert_eq!(1, state.events.allocs());
   checkers::verify!(state);
}

#[checkers::test(verify = "verify_test_custom_verify")]
fn test_custom_verify() {
    let _ = Box::into_raw(vec![1, 2, 3, 4, 5].into_boxed_slice());
}