Redian新闻
>
VC++ 中的 memory leak problem
avatar
VC++ 中的 memory leak problem# Programming - 葵花宝典
w*g
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 ?
avatar
k*f
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 ?

avatar
w*g
3

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

【在 k****f 的大作中提到】
: 安装boundchecker
avatar
F*n
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
avatar
w*g
5
Thanks a lot. I will try that
avatar
m*f
6
purify很好用, 但是最新的purify不支持最新的visual studio
avatar
w*g
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

avatar
p*o
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.

avatar
w*g
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.

avatar
p*o
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 ?

avatar
z*i
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 ?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。