Archived

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

Memory Leaks

This topic is 5177 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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