使用Visual Leak Detector检测内存泄漏
http://www.ltesting.net/AutoTest/Opentest/200609/896.htm
Introduction
Visual C++ provides built-in memory leak detection, but its capabilities are minimal at best. This memory leak detector was created as a free alternative to the built-in memory leak detector provided with Visual C++. Here are some of Visual Leak Detector's features, none of which exist in the built-in detector:
- Provides a complete stack trace for each leaked block, including source file and line number information when available.
- Provides complete data dumps (in hex and ASCII) of leaked blocks.
- Customizable level of detail in the memory leak report.
Other after-market leak detectors for Visual C++ are already available. But most of the really popular ones, like Purify and BoundsChecker, are very expensive. A few free alternatives exist, but they're often too intrusive, restrictive, or unreliable. Here are some key advantages that Visual Leak Detector has over many other free alternatives:
- Visual Leak Detector is cleanly packaged as an easy-to-use library. You don't need to compile its source code to use it. And you only need to make minor additions to your own source code to integrate it with your program.
- In addition to providing stack traces with source files, line numbers, and function names, Visual Leak Detector also provides data dumps.
- It works with both C++ and C programs (compatible with both
new
/delete
andmalloc
/free
). - The full source code to the library is included and it is well documented, so it is easy to customize it to suit your needs.
Visual Leak Detector is licensed free of charge as a service to the Windows developer community.
http://www.codeproject.com/KB/applications/visualleakdetector.aspx