How to debug memory leaks in MFC program
-
sir, i make obe program in MFC .i want to debug any memory leaks in my program .how can i find out memeory leak
-
sir, i make obe program in MFC .i want to debug any memory leaks in my program .how can i find out memeory leak
aloktambi wrote:
how can i find out memeory leak
by seeing the memory use growing and growing while your application is running... this is very hard to track with a tool... the best thing to avoid memory leaks is still to take much care when handling heap memory... when you
malloc()
or when younew
some memory on the heap, be sure tofree()
ordelete
it when it is no longer used...
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
sir, i make obe program in MFC .i want to debug any memory leaks in my program .how can i find out memeory leak
If you want an easy solution (yeah, I always prefere a solution where I don't need to read a bunch of articles ;P ), you can simply launch the debugger (press F5) and then, when your program exits, you will have a dump of all memory leaks your program produced (and you can double-click on the lines and it will show where the memory has been allocated). But this works only when the memory has been allocated with new and of course it only shows you the memory leaks your program produced (not all potential ones). That is, if there is function that is called when you press a button and if there is a leak within it, if you don't press the button, the leak won't be detected.