Memory tracking is enabled by default in MFC Debug builds. AfxEnableMemoryTracking is mainly used to temporarily disable memory tracking in some code snippets, if necessary. To use the MFC built-in memory leak detection, make sure that each .cpp file contains the following code after all #include lines:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
source
share