made all define configs configurable in runtime per heap

This commit is contained in:
2026-06-10 01:09:36 +02:00
parent 9dd2ebaa5a
commit e17def2790
3 changed files with 119 additions and 103 deletions

View File

@@ -32,16 +32,13 @@ void* myptrs[NUM_ALLOCATIONS] = { 0 };
int main()
{
MIHP_HeapConfig config = {0};
MIHP_HeapConfig config = MIHP_MakeDefaultConfigPreset();
config.PlatformRequestMemoryFn = RequestMemory;
config.PlatformFreeMemoryFn = FreeMemory;
config.OnHeapCorruptionDetectedFn = OnHeapCorruptionDetectedCallback;
config.AllocationInitialValue = 0xbe;
config.AllocationAlignment = 16;
config.MinimalMemoryAreaSize = 4096 * 32;
config.MaximalMemoryAreaSize = 4096ull * 4096ull * 4096ull;
config.HeapValidationMode = MIHP_HVM_None;
MIHP_Heap myHeap = { 0 };
MIHP_InitializeHeap(&myHeap, config);