#define WALKHEAP() WalkHeap(0) #define WALKHEAPTRACE() WalkHeap(1) * HeapRec - a list of all non-contiguous heap areas const int maxHeaps = 32; /* 64 was overkill */ * Use VirtualAlloc() for blocks bigger than nMaxHeapAllocSize since const int nMaxHeapAllocSize = (1024*512); /* don't allocate anything larger than this from the heap */ int HeapAdd(void* ptr, size_t size BOOL bRet = (NULL != (m_hHeap = HeapCreate(HEAP_NO_SERIALIZE, ASSERT(HeapValidate(m_hHeap, HEAP_NO_SERIALIZE, NULL)); BOOL bRet = HeapDestroy(m_hHeap); HeapFree(m_hHeap, HEAP_NO_SERIALIZE, m_heaps[index].base); ptr = HeapReAlloc(m_hHeap, HEAP_REALLOC_IN_PLACE_ONLY|HEAP_NO_SERIALIZE, HeapAdd(((char*)ptr) + m_heaps[m_nHeaps-1].len, size ptr = HeapAlloc(m_hHeap, HEAP_NO_SERIALIZE, size); if (HeapAdd(ptr, size)) { if (HeapAdd(ptr, size, bBigBlock)) { HeapAdd(ptr, size); int VMem::HeapAdd(void* p, size_t size void VMem::WalkHeap(int complete) MemoryUsageMessage("VMem heaps used %d. Total memory %08x\n", m_nHeaps, total, 0); ASSERT(HeapValidate(m_hHeap, HEAP_NO_SERIALIZE, ptr));