Memory Leak Detection in MFC
This topic applies to:
| Visual Studio Edition | Visual Basic | C# | C++ | J# |
| Express | No | No | Native | No |
| Standard | No | No | Native | No |
| Pro/Team | No | No | Native | No |
MFC provides classes and functions for detecting memory that is allocated but never deallocated.
In This Section
- Tracking Memory Allocations
-
Discusses the DEBUG_NEW macro, which you can use to locate memory leaks. Information includes considerations in Debug and Release versions, defining the macro in your source files, and object dumps.
- Enabling Memory Diagnostics
-
Provides steps for enabling diagnostic tracing and selecting specific memory diagnostic features with afxMemDF (for more precise control).
- Taking Memory Snapshots
-
Shows how to take snapshots of memory to help locate memory leaks.
- Viewing Memory Statistics
-
Describes the CMemoryState::Difference function (compares memory) and the CMemoryState::DumpStatistics (prints memory statistics) and provides code examples.
- Object Dumps
-
Provides information on object dumps, including the DumpAllObjectsSince function, example code, and considerations, as well as interpreting and customizing object dumps.