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 ?
|