Dumps all the memory blocks in the debug heap when a memory leak has occurred (debug version only).
int _CrtDumpMemoryLeaks( void );
TRUE if a memory leak is found. Otherwise, the function returns
_CrtDumpMemoryLeaks function determines whether a memory leak has occurred since the start of program execution. When a leak is found, the debug header information for all the objects in the heap is dumped in a user-readable form. When
_DEBUG isn't defined, calls to
_CrtDumpMemoryLeaks are removed during preprocessing.
_CrtDumpMemoryLeaks is frequently called at the end of program execution to verify that all memory allocated by the application has been freed. The function can be called automatically at program termination by turning on the
_CRTDBG_LEAK_CHECK_DF bit field of the
_crtDbgFlag flag using the
_CrtMemCheckpoint to obtain the current state of the heap and then scans the state for blocks that haven't been freed. When an unfreed block is encountered,
_CrtMemDumpAllObjectsSince to dump information for all the objects allocated in the heap from the start of program execution.
By default, internal C run-time blocks (
_CRT_BLOCK) aren't included in memory dump operations. The
_CrtSetDbgFlag function can be used to turn on the
_CRTDBG_CHECK_CRT_DF bit of
_crtDbgFlag to include these blocks in the leak detection process.
For more information about heap state functions and the
_CrtMemState structure, see Heap State Reporting Functions. For more information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see CRT Debug Heap Details.
For more compatibility information, see Compatibility.
Debug versions of C run-time libraries only.
For a sample of how to use
Submit and view feedback for