diff --git a/substrate/core/executor/src/allocator.rs b/substrate/core/executor/src/allocator.rs index 9e61a2c6ef..504b96987f 100644 --- a/substrate/core/executor/src/allocator.rs +++ b/substrate/core/executor/src/allocator.rs @@ -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],