From 7095e2abc4277ebd7179a67cf7590e3917e34536 Mon Sep 17 00:00:00 2001 From: ToyB-Chan Date: Mon, 8 Jun 2026 19:26:21 +0200 Subject: [PATCH] removed TotalOccupiedSize stats because of inaccuracy --- minimal_heap.h | 1 - minimal_heap_implementation.inl | 4 ---- 2 files changed, 5 deletions(-) diff --git a/minimal_heap.h b/minimal_heap.h index f341c7d..cb59720 100644 --- a/minimal_heap.h +++ b/minimal_heap.h @@ -58,7 +58,6 @@ typedef struct _MIHP_HeapStats size_t NumTotalSegments; size_t NumTotalOccupiedSegments; size_t TotalSize; - size_t TotalOccupiedSize; } MIHP_HeapStats; // This structs size must be multiple of 8 diff --git a/minimal_heap_implementation.inl b/minimal_heap_implementation.inl index 3db0db5..241783c 100644 --- a/minimal_heap_implementation.inl +++ b/minimal_heap_implementation.inl @@ -119,7 +119,6 @@ void* MIHP_Allocate(MIHP_Heap* heap, size_t size) currentArea->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(currentArea); heap->Stats.NumTotalOccupiedSegments++; - heap->Stats.TotalOccupiedSize += targetSegment->OccupiedSize; heap->LastSuccessfulAllocationArea = currentArea; MIHP_UNLOCK_HEAP(&heap->HeapLock); @@ -251,8 +250,6 @@ bool MIHP_Free(MIHP_Heap* heap, void* ptr) MIHP_HeapMemoryAreaHeader* area = segment->OwningMemoryArea; MIHP_ValidateHeapMemoryAreaHeader(heap, area); - size_t occupiedSize = segment->OccupiedSize; - segment->OccupiedSize = 0; segment->Checksum = MIHP_GenerateHeapSegmentChecksum(segment); @@ -260,7 +257,6 @@ bool MIHP_Free(MIHP_Heap* heap, void* ptr) area->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(area); heap->Stats.NumTotalOccupiedSegments--; - heap->Stats.TotalOccupiedSize -= occupiedSize; if (area->NumOccupiedSegments == 0 && heap->Stats.NumMemoryAreas > 1) {