Archived

This topic is now archived and is closed to further replies.

Greg K

Memory Leaks

Recommended Posts

Greg K    122
In VC6.0 is there any way to tell if you have a memory leak? I don''t mean coding a new "new" keyword and a new "delete" keyword but just like a flag or something that tells you if there is any residual allocated memory (and ideally how much). -Greg

Share this post


Link to post
Share on other sites
VolkerG    151
There are some functions starting with _Crt... You should find the correct one in the help file. I''m now using VS7 and forgot how it was exactly when using version 6.
Perhaps there exists an appropriate flag for _CrtSetDbgFlag (), like in the newer version.

Share this post


Link to post
Share on other sites
dr_slash_uh    122
one time when I was programming I my program would always crash after a copule of minutes. I hit CRTL ALT DELETE and noticed my memory available was falling like a rock. I found out I was using a new in a loop without a delete and I was requesting memory without deleting it. That also can happen with other functions that allocate memory and that you have to manually deallocate it.

Share this post


Link to post
Share on other sites
cnstrnd    118
You can specify a breakpoint at the beginning of
your code (cant remember the function ... BreakOnAlloc
or something).

Note the {alloc id number} you get in the dump,
pass this value to the function above, recompile,
run, test and there you go. You've got the line AND
the complete context of your program at allocation
time.

[edited by - cnstrnd on October 10, 2003 12:18:19 AM]

Share this post


Link to post
Share on other sites