如何检测内存泄漏 int _CrtSetDbgFlag( int newFlag );
2008-05-06 09:28
357 查看
#include <crtdbg.h>
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
Retrieves or modifies the state of the _crtDbgFlag flag to control the allocation behavior of the debug heap manager (debug version only).
The _CrtSetDbgFlag function allows the application to control how the debug heap manager tracks memory allocations by modifying the bit fields of the _crtDbgFlag flag. By setting the bits (turning on), the application can instruct the debug heap manager to perform special debugging operations, including checking for memory leaks when the application exits and reporting if any are found, simulating low-memory conditions by specifying that freed memory blocks should remain in the heap's linked list, and verifying the integrity of the heap by inspecting each memory block at every allocation request. When _DEBUG is not defined, calls to _CrtSetDbgFlag are removed during preprocessing.
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
Retrieves or modifies the state of the _crtDbgFlag flag to control the allocation behavior of the debug heap manager (debug version only).
The _CrtSetDbgFlag function allows the application to control how the debug heap manager tracks memory allocations by modifying the bit fields of the _crtDbgFlag flag. By setting the bits (turning on), the application can instruct the debug heap manager to perform special debugging operations, including checking for memory leaks when the application exits and reporting if any are found, simulating low-memory conditions by specifying that freed memory blocks should remain in the heap's linked list, and verifying the integrity of the heap by inspecting each memory block at every allocation request. When _DEBUG is not defined, calls to _CrtSetDbgFlag are removed during preprocessing.
相关文章推荐
- 如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delet
- [转]如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delete
- 如何检测内存泄漏——重载new和delete
- 如何使用 CRT 调试功能来检测内存泄漏
- VC++ 6.0 中如何使用 CRT 调试功能来检测内存泄漏 - 2
- 如何检测内存泄漏
- 如何检测和处理内存泄漏
- 如何在linux下检测内存泄漏
- VC++ 6.0 中如何使用 CRT 调试功能来检测内存泄漏
- 如何在linux下检测内存泄漏
- VC++ 6.0 中如何使用 CRT 调试功能来检测内存泄漏
- 如何检测内存泄漏
- Tomcat如何检测内存泄漏
- 如何在linux下检测内存泄漏
- VC++ 6.0 中如何使用 CRT 调试功能来检测内存泄漏