Advertisement

Memory leaks and other funnies...

Started by November 20, 2000 02:21 AM
2 comments, last by mr BiCEPS 24 years, 2 months ago
Hi. i was wondering if there are any good tools, that can detect if your program leaves any allocated memory on exit. Please don''t say NuMega BoundsChecker... I don''t have that kind of money... I was also wondeting if there are any tools that can tell how much memory your program has allocated, in total. -mr BiCEPS
I guess you could override the new and delete operators and do your own checking there. Have a variable that you increase when you allocate memory, and decrese when you deallocate. You could also add functionality that gets the calling address from stack, and saves it in a list so you can see which new is unmatched. Of course this can slow down your program a bit, but not too much, because memory allocation is already quite slow. Then make a checking function that you call on exit.
Advertisement
Take a look at www.flipcode.com .. the Ask Midnight column
If you''re using VC++, look up _CrtDumpMemoryLeaks() in the MSDN. You should be able to find anything you need there.

Good luck!

This topic is closed to new replies.

Advertisement