You can easily use HeapCheck in your own programs in three easy steps:
That's it. Your code will be automatically checked for heap errors.
To get correct file/line information, make sure you are using the
correct versions of the debugging libraries (the Windows 2000 ones).
By default, range checks will be done for post-block accesses.
After checking that everything works OK in this setup, modify your project
so that PRE_CHECK is defined, or even edit
#define PRE_CHECKRecompile everything, and this way, pre-block checking will take place.
HeapCheck messages appear on the Debugging Output of Visual C++. If you are running the program outside the IDE, use DebugView to see them (get it from www.sysinternals.com, an awesome site for programming utilities by the way).
If you program with MFC, make sure you use it in the form of a dynamic DLL
(Project - Settings - General - Microsoft Foundation Classes - Use
MFC in a Shared DLL) . Otherwise, you 'll get link problems, since
MFC defines a global
When you have debugged your program, just recompile in Release mode. The debugging checks will melt away automatically.