MMHeap.cpp revision 1e9400ac417ac9391183aa61e11789f24e8ca8ff
2e848e79ccf2e4285250a0af98ddb9eb28864878vboxsync * MM - Memory Manager - Heap.
* available from http://www.virtualbox.org. This file is free software;
* Clara, CA 95054 USA or visit http://www.sun.com if you need
#include "MMInternal.h"
if (pHeap)
#ifdef MMR3HEAP_WITH_STATISTICS
STAMR3RegisterU(pUVM, &pStat->cAllocations, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cAllocations", STAMUNIT_CALLS, "Number or MMR3HeapAlloc() calls.");
STAMR3RegisterU(pUVM, &pStat->cReallocations, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cReallocations", STAMUNIT_CALLS, "Number of MMR3HeapRealloc() calls.");
STAMR3RegisterU(pUVM, &pStat->cFrees, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cFrees", STAMUNIT_CALLS, "Number of MMR3HeapFree() calls.");
STAMR3RegisterU(pUVM, &pStat->cFailures, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cFailures", STAMUNIT_COUNT, "Number of failures.");
STAMR3RegisterU(pUVM, &pStat->cbCurAllocated, sizeof(pStat->cbCurAllocated) == sizeof(uint32_t) ? STAMTYPE_U32 : STAMTYPE_U64,
STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cbCurAllocated", STAMUNIT_BYTES, "Number of bytes currently allocated.");
STAMR3RegisterU(pUVM, &pStat->cbAllocated, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cbAllocated", STAMUNIT_BYTES, "Total number of bytes allocated.");
STAMR3RegisterU(pUVM, &pStat->cbFreed, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, "/MM/R3Heap/cbFreed", STAMUNIT_BYTES, "Total number of bytes freed.");
return VINF_SUCCESS;
return VERR_NO_MEMORY;
while (pHdr)
if (pv)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
if (pv)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
if (pv)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
if (pv)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
#ifdef MMR3HEAP_WITH_STATISTICS
if (pStat)
if (!pStat)
return NULL;
STAMR3RegisterU(pUVM, &pStat->cAllocations, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_CALLS, "Number or MMR3HeapAlloc() calls.");
STAMR3RegisterU(pUVM, &pStat->cReallocations, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_CALLS, "Number of MMR3HeapRealloc() calls.");
STAMR3RegisterU(pUVM, &pStat->cFrees, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_CALLS, "Number of MMR3HeapFree() calls.");
STAMR3RegisterU(pUVM, &pStat->cFailures, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_COUNT, "Number of failures.");
STAMR3RegisterU(pUVM, &pStat->cbCurAllocated, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_BYTES, "Number of bytes currently allocated.");
STAMR3RegisterU(pUVM, &pStat->cbAllocated, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_BYTES, "Total number of bytes allocated.");
STAMR3RegisterU(pUVM, &pStat->cbFreed, STAMTYPE_U64, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_BYTES, "Total number of bytes freed.");
if (cbSize == 0)
#ifdef MMR3HEAP_WITH_STATISTICS
return NULL;
if (!pHdr)
#ifdef MMR3HEAP_WITH_STATISTICS
return NULL;
#ifdef MMR3HEAP_WITH_STATISTICS
#ifdef MMR3HEAP_WITH_STATISTICS
if (!pv)
return NULL;
if (!cbNewSize)
return NULL;
return NULL;
#ifdef MMR3HEAP_WITH_STATISTICS
if (!pHdrNew)
#ifdef MMR3HEAP_WITH_STATISTICS
return NULL;
#ifdef MMR3HEAP_WITH_STATISTICS
if (!psz)
return NULL;
if (pszDup)
return pszDup;
return psz;
return psz;
char *psz;
if (cch < 0)
return NULL;
if (pszRet)
return pszRet;
if (!pv)
#ifdef MMR3HEAP_WITH_STATISTICS
switch (enmTag)
return sz;