From ca40ee6ea467efd9ef2ecf767e39f70b6f04cb9d Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 21 Aug 2022 09:59:52 -0700 Subject: Add more debug statements --- src/mem/alloc.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mem/alloc.rs') diff --git a/src/mem/alloc.rs b/src/mem/alloc.rs index f3a8c8d..06ca469 100644 --- a/src/mem/alloc.rs +++ b/src/mem/alloc.rs @@ -420,6 +420,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U16_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 3..=4 => { @@ -430,6 +431,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U32_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 5..=8 => { @@ -440,6 +442,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U64_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 9..=16 => { @@ -450,6 +453,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U128_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 17..=32 => { @@ -460,6 +464,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U256_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 33..=64 => { @@ -470,6 +475,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U512_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 65..=128 => { @@ -480,6 +486,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U1024_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 129..=256 => { @@ -490,6 +497,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U2048_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } 257..=512 => { @@ -500,6 +508,7 @@ unsafe impl GlobalAlloc for GrandAllocator { assert!(index < GRAND_ALLOC_SIZE, "{} is out of the allocation bounds ({})", index, GRAND_ALLOC_SIZE); assert_eq!(diff % spacing, 0, "{} is not aligned with the spacings and so it must not have been allocated by the Grand Allocator", diff % spacing); U4096_GRAND_ALLOC.free(&mut pool[index+2]); + vprintln!("GA: Freeing ({}, {}, {})", index, diff, spacing); }); } _ => { -- cgit v1.2.1