X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Fheap.c;h=262053b02e03dce88e047223172c892062c8d6a3;hb=4cbfb47ebf71128b57cf25a131550b3f66a295a3;hp=07a3aad034a6f082982b5ed7e7cf18f1505ac4a5;hpb=3764c294f21229bdf700f436fa4884f5e76e0d3a;p=tpg%2Facess2.git diff --git a/Kernel/heap.c b/Kernel/heap.c index 07a3aad0..262053b0 100644 --- a/Kernel/heap.c +++ b/Kernel/heap.c @@ -211,6 +211,7 @@ void *Heap_Allocate(const char *File, int Line, size_t __Bytes) head->Magic = MAGIC_USED; head->File = File; head->Line = Line; + head->ValidSize = __Bytes; Mutex_Release(&glHeap); // Release spinlock #if DEBUG_TRACE Log("[Heap ] Malloc'd %p (%i bytes), returning to %p", head->Data, head->Size, __builtin_return_address(0)); @@ -246,6 +247,7 @@ void *Heap_Allocate(const char *File, int Line, size_t __Bytes) best->Magic = MAGIC_USED; // Mark block as used best->File = File; best->Line = Line; + head->ValidSize = __Bytes; Mutex_Release(&glHeap); // Release spinlock #if DEBUG_TRACE Log("[Heap ] Malloc'd %p (%i bytes), returning to %p", best->Data, best->Size, __builtin_return_address(0)); @@ -664,8 +666,12 @@ void Heap_Stats(void) // Print the block info? #if 1 - Log_Debug("Heap", "%p (0x%x) - 0x%x (%i) Owned by %s:%i", - head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size, head->ValidSize, head->File, head->Line); + if( head->Magic == MAGIC_FREE ) + Log_Debug("Heap", "%p (0x%llx) - 0x%x free", + head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size); + else + Log_Debug("Heap", "%p (0x%llx) - 0x%x (%i) Owned by %s:%i", + head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size, head->ValidSize, head->File, head->Line); #endif }