Check for stray resources after program termination

Started by
2 comments, last by SikCiv 24 years, 4 months ago
In VC6, there is a way to have it print out a listing of all memory that you didn't free, but it won't tell you which variable it is. It will tell you the address, size and contents for each block though.
Somewhere in your program (I usually put it right before the program exits), add the line:

_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);

When you run the program (in debug mode), a report will be printed out in the debug window after the program finishes executing.
include file is

Note: I have no idea if this works in other compilers, or environments other than windows 95/98/nt.

Advertisement
html got the include, should be crtdbg.h
Say a program uses many bitmap handles and malloc'd data, and doesnt release them all, is there a program to check for handles/data still in memory, or does the program release all handles and malloc'd data automatically?

  Downloads:  ZeroOne Realm

There are also commercial tools that do this sort of thing.

One of the best is called BoundsChecker... it's pricey, but for serious development, it's well worth the cash. Catches virtually all types of memory leaks, resource leaks, etc.

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!

This topic is closed to new replies.

Advertisement