在VS C ++ 6.0中,哪些调试工具可以很好地发现内存泄漏的地方? [英] In VS C++ 6.0, what debug tools are good to find where memory is leaking?
本文介绍了在VS C ++ 6.0中,哪些调试工具可以很好地发现内存泄漏的地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的程序最终消耗掉了所有的内存并崩溃了...浏览代码,我找不到任何能做到这一点的东西.
My program eventually consumes all ram and crashes... looking through the code, I can't find anything that stands out that would do this.
推荐答案
是否可以修改代码以使用malloc
和free
的调试版本?如果是,请检查 _malloc_dbg 和
Could you modify the code to use the debug version of malloc
and free
? If yes, check _malloc_dbg and _free_dbg.
(您可以根据这些函数编写自己的new
和delete
运算符.)
(You could write own new
and delete
operators based on these functions.)
我记得VS 6.0没有_realloc_dbg
.
As I remember VS 6.0 has no _realloc_dbg
.
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC 1
#include <Crtdbg.h>
#define malloc(size) _malloc_dbg(size,_CLIENT_BLOCK,__FILE__,__LINE__)
#define free(addr) _free_dbg(addr,_CLIENT_BLOCK)
#endif
这篇关于在VS C ++ 6.0中,哪些调试工具可以很好地发现内存泄漏的地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文