由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - VC++ 中的 memory leak problem
相关主题
STL堆操作怎样对堆顶元素做ShiftDown?问一个有关iostream的问题
学习VC++求教VS里debug不work求教!
VC下的一个运行错误--高手请进!C++: operator new 为啥要是 static的, 不是有啥影响?
有谁对glibc的allocator有研究?Does VC++ 6.0 not support dynamic cast?
一个怪怪的bug熟悉visual studio的朋友请帮一下忙
MFC 文档/视 调整窗口大小的问题c++标准函数传递一问
20个包子求帮忙把命令行模式C程序改成窗口界面的C语言重复定义问题
请教一个问题 VC 6 Non-MFC app tries to include nafxcwd.lib程序从VC6挪到VC2008后,执行速度低了15-30%
相关话题的讨论汇总
话题: memory话题: leak话题: c++话题: program话题: vc
进入Programming版参与讨论
1 (共1页)
w****g
发帖数: 44
1
How to find the memory leak quickly and fix it in C++ program using Visual
Studio?
Are there any way to check the memory leak in VC ? such as memory log ?
k****f
发帖数: 3794
2
安装boundchecker

【在 w****g 的大作中提到】
: How to find the memory leak quickly and fix it in C++ program using Visual
: Studio?
: Are there any way to check the memory leak in VC ? such as memory log ?

w****g
发帖数: 44
3

哪里找到免费版??
我记得VC 里有个设置可以看 MEMORY PROFILE的?不知怎么弄?
谢谢

【在 k****f 的大作中提到】
: 安装boundchecker
F*****n
发帖数: 1552
4
当年找memory leak的时候颇费了番功夫。后来在msdn里面看到一个方法,很管用,当
时就记下了。给你作个参考,呵呵
//This is how to debug memory leak.
//Add #define _CRTDBG_MAP_ALLOC #include #include
//at the beginning and add the following statement in the program.
//Then run debug (F5)
//System will return where memory leaks, a number within {}
//Then at very beginning of the program, set a breakpoint, run debug.
//When program stops at the breakpoint, in watch window, set the value
//of function _crtBreakAlloc to that num
w****g
发帖数: 44
5
Thanks a lot. I will try that
m*f
发帖数: 8162
6
purify很好用, 但是最新的purify不支持最新的visual studio
w****g
发帖数: 44
7
why my break point is at dbgheap.c file not my own program file ?
How can I find which function in my program caused the problem ?
Many thanks.
the memory leak dump info is:
Dumping objects ->
{82} normal block at 0x02E61188, 28 bytes long.
Data: 6C 5A 50 00 38 56 7A 02 48 20 7A 02 A0 20 7A 02
Object dump complete.
I include "#define _CRTDBG_MAP_ALLOC " already in the program.

【在 F*****n 的大作中提到】
: 当年找memory leak的时候颇费了番功夫。后来在msdn里面看到一个方法,很管用,当
: 时就记下了。给你作个参考,呵呵
: //This is how to debug memory leak.
: //Add #define _CRTDBG_MAP_ALLOC #include #include
: //at the beginning and add the following statement in the program.
: //Then run debug (F5)
: //System will return where memory leaks, a number within {}
: //Then at very beginning of the program, set a breakpoint, run debug.
: //When program stops at the breakpoint, in watch window, set the value
: //of function _crtBreakAlloc to that num

p***o
发帖数: 1252
8

Did you use _malloc_dbg?
As I remember, when you create a MFC project in VC6, all the necessary
codes for detecting memory leaks are generated. You can learn from them.

【在 w****g 的大作中提到】
: why my break point is at dbgheap.c file not my own program file ?
: How can I find which function in my program caused the problem ?
: Many thanks.
: the memory leak dump info is:
: Dumping objects ->
: {82} normal block at 0x02E61188, 28 bytes long.
: Data: 6C 5A 50 00 38 56 7A 02 48 20 7A 02 A0 20 7A 02
: Object dump complete.
: I include "#define _CRTDBG_MAP_ALLOC " already in the program.

w****g
发帖数: 44
9
This is not MFC related. I just used VC as a editor,compiler and debugger.
which file stores such info ?

【在 p***o 的大作中提到】
:
: Did you use _malloc_dbg?
: As I remember, when you create a MFC project in VC6, all the necessary
: codes for detecting memory leaks are generated. You can learn from them.

p***o
发帖数: 1252
10
What I said is that you can learn from MFC on how to use those CrtXXX
functions.
Otherwise just google _malloc_dbg and look into the last two parameters.
You have to override new/malloc someway to add file/line info.

【在 w****g 的大作中提到】
: This is not MFC related. I just used VC as a editor,compiler and debugger.
: which file stores such info ?

z******i
发帖数: 59
11
gflags -- turn memory malloc trace on
umdh -- user mode heap dump

【在 w****g 的大作中提到】
: How to find the memory leak quickly and fix it in C++ program using Visual
: Studio?
: Are there any way to check the memory leak in VC ? such as memory log ?

1 (共1页)
进入Programming版参与讨论
相关主题
程序从VC6挪到VC2008后,执行速度低了15-30%一个怪怪的bug
windows 7 下的C 和shell 编程软件MFC 文档/视 调整窗口大小的问题
师傅们都出来看看吧,我也问个C++返回值问题。20个包子求帮忙把命令行模式C程序改成窗口界面的
javascript才是未来发展的方向请教一个问题 VC 6 Non-MFC app tries to include nafxcwd.lib
STL堆操作怎样对堆顶元素做ShiftDown?问一个有关iostream的问题
学习VC++求教VS里debug不work求教!
VC下的一个运行错误--高手请进!C++: operator new 为啥要是 static的, 不是有啥影响?
有谁对glibc的allocator有研究?Does VC++ 6.0 not support dynamic cast?
相关话题的讨论汇总
话题: memory话题: leak话题: c++话题: program话题: vc