Skip to main content
gamedev.net
🔒 Locked

Memory Leaks

Started by Greg K Oct 10, 2003 at 3:30 PM 4 replies 400+ views
Original Post
Greg K
Greg K
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
VolkerG
VolkerG
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.
dr_slash_uh
dr_slash_uh
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.
Greg K
Greg K
Okay, I have it dumping the memory adress. Is there any way to link that with a line number where the "new" was used?
-Greg
cnstrnd
cnstrnd
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]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.