【发布时间】:2012-06-12 23:57:19
【问题描述】:
我正在用一条不太有用的诊断消息来追踪一个内存错误:
HEAP[myprogram_run.exe]: HEAP: Free Heap block e0969b0 modified at e096a70 after it was freed
Windows has triggered a breakpoint in myprogram_run.exe.
This may be due to a corruption of the heap, and indicates a bug in myprogram_run.exe or any of
the DLLs it has loaded.
The output window may have more diagnostic information
The program '[9340] myprogram_run.exe: Native' has exited with code -1 (0xffffffff).
环顾四周后,我在这些 MSDN 链接中找到: http://msdn.microsoft.com/en-US/library/e5ewb1h3%28v=vs.80%29 我将我的项目属性预处理器定义(在 C/C++ 下)设置为包含 _DEBUG,并且在我的主函数中,我还按照推荐的顺序添加了以下内容(在上面的链接中):
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
...
int main(..,..) {
...
_CrtDumpMemoryLeaks();
return retval;
}
但我在 Visual Studio 解决方案的输出窗口中仍然看不到广告的诊断输出(包括行号等)?感谢有关如何正确诊断此问题的任何见解。谢谢!
我可以在项目属性下设置
【问题讨论】:
-
您是在使用“开始调试”(F5) 还是“开始不调试”(Ctrl+F5)?
-
谢谢.. 是的,我知道这一点,我使用的是 F5,而不是 Ctrl+F5
标签: c++ windows memory memory-management visual-studio-2005