From 2289ec8644aed1336a16909c0cee6a13f9611051 Mon Sep 17 00:00:00 2001 From: ToyB-Chan Date: Sun, 14 Jun 2026 04:17:03 +0200 Subject: [PATCH] more asserts --- minimal_heap_implementation.inl | 3 +++ minimal_heap_test.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/minimal_heap_implementation.inl b/minimal_heap_implementation.inl index 889a0e5..5721840 100644 --- a/minimal_heap_implementation.inl +++ b/minimal_heap_implementation.inl @@ -610,7 +610,10 @@ MIHP_HeapMemoryAreaHeader* MIHP_CreateHeapMemoryArea(MIHP_Heap* heap, size_t req if (area == NULL) return NULL; + MIHP_ASSERT((uintptr_t)area % heap->Config.AllocationAlignment == 0); + MIHP_ASSERT(actualSize % heap->Config.AllocationAlignment == 0); MIHP_ASSERT(actualSize >= effectiveSize); + MIHP_MEMSET(area, 0, sizeof(MIHP_HeapMemoryAreaHeader)); area->InstigatingHeap = (MIHP_HeapOpaque)heap; diff --git a/minimal_heap_test.cpp b/minimal_heap_test.cpp index 50737fe..ca596d0 100644 --- a/minimal_heap_test.cpp +++ b/minimal_heap_test.cpp @@ -10,7 +10,7 @@ #define USE_MALLOC 0 -//#define MIHP_ValidateHeap(x) +#define MIHP_ValidateHeap(x) void* RequestMemory(MIHP_HeapOpaque heap, size_t minRequestedSize, size_t* outActualSize) { @@ -29,7 +29,7 @@ void OnHeapCorruptionDetectedCallback(const MIHP_Heap* heap, MIHP_HeapCorruption __debugbreak(); } -#define NUM_ALLOCATIONS (4096) +#define NUM_ALLOCATIONS (4096 * 4096) void* myptrs[NUM_ALLOCATIONS] = { 0 };