removed TotalOccupiedSize stats because of inaccuracy

This commit is contained in:
2026-06-08 19:26:21 +02:00
parent 174be6a022
commit 7095e2abc4
2 changed files with 0 additions and 5 deletions

View File

@@ -58,7 +58,6 @@ typedef struct _MIHP_HeapStats
size_t NumTotalSegments; size_t NumTotalSegments;
size_t NumTotalOccupiedSegments; size_t NumTotalOccupiedSegments;
size_t TotalSize; size_t TotalSize;
size_t TotalOccupiedSize;
} MIHP_HeapStats; } MIHP_HeapStats;
// This structs size must be multiple of 8 // This structs size must be multiple of 8

View File

@@ -119,7 +119,6 @@ void* MIHP_Allocate(MIHP_Heap* heap, size_t size)
currentArea->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(currentArea); currentArea->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(currentArea);
heap->Stats.NumTotalOccupiedSegments++; heap->Stats.NumTotalOccupiedSegments++;
heap->Stats.TotalOccupiedSize += targetSegment->OccupiedSize;
heap->LastSuccessfulAllocationArea = currentArea; heap->LastSuccessfulAllocationArea = currentArea;
MIHP_UNLOCK_HEAP(&heap->HeapLock); MIHP_UNLOCK_HEAP(&heap->HeapLock);
@@ -251,8 +250,6 @@ bool MIHP_Free(MIHP_Heap* heap, void* ptr)
MIHP_HeapMemoryAreaHeader* area = segment->OwningMemoryArea; MIHP_HeapMemoryAreaHeader* area = segment->OwningMemoryArea;
MIHP_ValidateHeapMemoryAreaHeader(heap, area); MIHP_ValidateHeapMemoryAreaHeader(heap, area);
size_t occupiedSize = segment->OccupiedSize;
segment->OccupiedSize = 0; segment->OccupiedSize = 0;
segment->Checksum = MIHP_GenerateHeapSegmentChecksum(segment); segment->Checksum = MIHP_GenerateHeapSegmentChecksum(segment);
@@ -260,7 +257,6 @@ bool MIHP_Free(MIHP_Heap* heap, void* ptr)
area->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(area); area->Checksum = MIHP_GenerateHeapMemoryAreaChecksum(area);
heap->Stats.NumTotalOccupiedSegments--; heap->Stats.NumTotalOccupiedSegments--;
heap->Stats.TotalOccupiedSize -= occupiedSize;
if (area->NumOccupiedSegments == 0 && heap->Stats.NumMemoryAreas > 1) if (area->NumOccupiedSegments == 0 && heap->Stats.NumMemoryAreas > 1)
{ {