From 68bc1af94f8ec2fe5039b1d0bcaabd36e973f224 Mon Sep 17 00:00:00 2001 From: Evan Richter Date: Tue, 8 Nov 2022 21:20:46 -0600 Subject: [PATCH] detect fragmentation when fuzzing --- fuzz/fuzz_targets/chaos.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fuzz/fuzz_targets/chaos.rs b/fuzz/fuzz_targets/chaos.rs index 61a2d7d..795b211 100644 --- a/fuzz/fuzz_targets/chaos.rs +++ b/fuzz/fuzz_targets/chaos.rs @@ -117,4 +117,8 @@ fn fuzz(size: u16, actions: Vec) { heap.deallocate(ptr, layout); } } + + // make sure we can allocate the full heap (no fragmentation) + let full = Layout::from_size_align(heap.size(), 1).unwrap(); + assert!(heap.allocate_first_fit(full).is_ok()); }