}
/**
- * \fn void *Heap_Extend(int Bytes)
* \brief Extend the size of the heap
*/
void *Heap_Extend(int Bytes)
}
/**
- * \fn void *Heap_Merge(tHeapHead *Head)
* \brief Merges two ajacent heap blocks
*/
void *Heap_Merge(tHeapHead *Head)
}
/**
- * \brief Allocate memory from the heap
* \param File Allocating source file
* \param Line Source line
- * \param Bytes Size of region to allocate
+ * \param __Bytes Size of region to allocate
*/
void *Heap_Allocate(const char *File, int Line, size_t __Bytes)
{
head->AllocateTime = now();
Mutex_Release(&glHeap); // Release spinlock
#if DEBUG_TRACE
- Debug("[Heap ] Malloc'd %p (%i bytes), returning to %p", head->Data, head->Size, __builtin_return_address(0));
+ Debug("[Heap ] Malloc'd %p (%i bytes), returning to %p",
+ head->Data, head->Size, __builtin_return_address(0));
#endif
return head->Data;
}
}
/**
- * \fn void Heap_Deallocate(void *Ptr)
* \brief Free an allocated memory block
*/
void Heap_Deallocate(void *Ptr)
// Sanity check
if((Uint)Ptr < (Uint)gHeapStart || (Uint)Ptr > (Uint)gHeapEnd)
{
- Log_Warning("Heap", "free - Passed a non-heap address (%p < %p < %p)\n",
- gHeapStart, Ptr, gHeapEnd);
+ Log_Warning("Heap", "free - Passed a non-heap address by %p (%p < %p < %p)\n",
+ __builtin_return_address(0), gHeapStart, Ptr, gHeapEnd);
return;
}
{
foot = (void*)( (Uint)head + head->Size - sizeof(tHeapFoot) );
#if VERBOSE_DUMP
- Log_Log("Heap", "%p (0x%P): 0x%08lx (%i) %4C",
- head, MM_GetPhysAddr((Uint)head), head->Size, head->ValidSize, &head->Magic);
+ Log_Log("Heap", "%p (0x%P): 0x%08x (%i) %4C",
+ head, MM_GetPhysAddr((tVAddr)head), head->Size, head->ValidSize, &head->Magic);
Log_Log("Heap", "%p %4C", foot->Head, &foot->Magic);
if(head->File) {
Log_Log("Heap", "%sowned by %s:%i",
Log_Log("Heap", "%p (%P): 0x%08lx %i %4C",
head, MM_GetPhysAddr((Uint)head), head->Size, head->ValidSize, &head->Magic);
if(foot)
- Log_Log("Heap", "Foot %p = {Head:%p,Magic=:%4C}", foot, foot->Head, &foot->Magic);
+ Log_Log("Heap", "Foot %p = {Head:%p,Magic:%4C}", foot, foot->Head, &foot->Magic);
if(head->File) {
Log_Log("Heap", "%sowned by %s:%i",
(head->Magic==MAGIC_FREE?"was ":""), head->File, head->Line);