MFC provides the following classes to help you debug dynamic memory allocation problems.
CDumpContext
Provides a destination for diagnostic dumps.
CMemoryState
Structure that provides snapshots of memory use. Also used to compare earlier and later memory snapshots.