Include padding in heap size calculation
Closes
@@ -67,7 +67,6 @@ impl FreeingBumpHeapAllocator {
let current_size: Bytes = mem.current_size().into();
let current_size = current_size.0 as u32;
let used_size = mem.used_size().0 as u32;
- let heap_size = current_size - used_size;
let mut ptr_offset = used_size;
let padding = ptr_offset % ALIGNMENT;
@@ -75,6 +74,8 @@ impl FreeingBumpHeapAllocator {
ptr_offset += ALIGNMENT - padding;
}
+ let heap_size = current_size - ptr_offset;
+
FreeingBumpHeapAllocator {
bumper: 0,
heads: [0; N],
