aboutsummaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/alloc.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mem/alloc.rs b/src/mem/alloc.rs
index e06230d..66a8778 100644
--- a/src/mem/alloc.rs
+++ b/src/mem/alloc.rs
@@ -274,8 +274,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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);
U8_GRAND_ALLOC.free(&mut pool[index]);
});
}
@@ -284,8 +284,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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]);
});
}
@@ -294,8 +294,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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]);
});
}
@@ -304,8 +304,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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]);
});
}
@@ -314,8 +314,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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]);
});
}
@@ -324,8 +324,8 @@ unsafe impl GlobalAlloc for GrandAllocator {
let spacing: usize = (pool[3].ptr() as usize) - (pool[2].ptr() as usize);
let diff: usize = (ptr as usize) - (pool[2].ptr() as usize);
let index: usize = diff/spacing;
- assert!(index < GRAND_ALLOC_SIZE);
- assert_eq!(diff % spacing, 0);
+ 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]);
});
}