void trace_leaks()
{
PROCESS_HEAP_ENTRY heapentry;
HANDLE hHeap = GetProcessHeap();
heapentry.lpData = NULL;
HeapLock(hHeap);
while(HeapWalk(hHeap, &heapentry))
{
char szMessage[201];
wsprintf( szMessage,
"Allocated block at %08x, size %d\n",
heapentry.lpData,
heapentry.cbData);
OutputDebugStringA(szMessage);
}
HeapUnlock(hHeap);
}