From bed4193d78a9f7670a5620188f1822fb39ba8cf7 Mon Sep 17 00:00:00 2001 From: ToyB-Chan Date: Sat, 13 Jun 2026 07:22:48 +0200 Subject: [PATCH] Update minimal_heap_test.cpp --- minimal_heap_test.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/minimal_heap_test.cpp b/minimal_heap_test.cpp index 19114ef..6040a5d 100644 --- a/minimal_heap_test.cpp +++ b/minimal_heap_test.cpp @@ -48,17 +48,20 @@ void BootstrapHeap() config.HeapValidationMode = MIHP_HVM_MagicNumber; - MIHP_Heap* tmpHeap = new MIHP_Heap(); - memset(tmpHeap, 0, sizeof(MIHP_Heap)); - MIHP_InitializeHeap(tmpHeap, config); + MIHP_Heap* bootstrappedHeap = NULL; - MIHP_Heap* bootstrappedHeap = (MIHP_Heap*)MIHP_Allocate(tmpHeap, sizeof(MIHP_Heap)); - memset(bootstrappedHeap, 0, sizeof(MIHP_Heap)); - MIHP_InitializeHeap(bootstrappedHeap, config); + { + MIHP_Heap tmpHeap = { 0 }; + MIHP_InitializeHeap(&tmpHeap, config); - MIHP_MergeHeaps(bootstrappedHeap, tmpHeap); - delete tmpHeap; - //MIHP_Free(bootstrappedHeap, bootstrappedHeap); + MIHP_Heap* bootstrappedHeap = (MIHP_Heap*)MIHP_Allocate(&tmpHeap, sizeof(MIHP_Heap)); + memset(bootstrappedHeap, 0, sizeof(MIHP_Heap)); + MIHP_InitializeHeap(bootstrappedHeap, config); + + MIHP_MergeHeaps(bootstrappedHeap, &tmpHeap); + } + + // bootstrappedHeap is ready to use __debugbreak(); }