Dumping All Objects

This topic explains how to obtain a diagnostic dump of all objects in your program.

For information on dumping C run-time objects, see Using the Debug Heap and _CrtSetDbgFlag.

DumpAllObjectsSince dumps out a description of all objects detected on the heap that have not been deallocated. As the name implies, DumpAllObjectsSince dumps all objects allocated since the last Checkpoint. However, if no Checkpoint has taken place, all objects and nonobjects currently in memory are dumped.

Note   Before you can use MFC object dumping, you must enable diagnostic tracing. See the Note in the topic Diagnostics.

To dump all objects

To set a breakpoint when a particular allocation occurs, first start your application in the debugger. Set the global variable _afxBreakAlloc to the number in braces discussed earlier. This will set a conditional breakpoint in your application that will trigger when the allocation you specify is being made. Looking at the call stack at this point will tell you the path your program took to get to the specified allocation.

The C run-time library has a similar function, _CrtSetBreakAlloc, that you can use for C run-time allocations.