Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DEBUG_NEW Macro
◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
#define new DEBUG_NEW
Remarks
Use to assist in finding memory leaks. You can use DEBUG_NEW everywhere
in your program that you would ordinarily use the new operator to
allocate heap storage.
In Debug mode (when the _DEBUG symbol is defined), DEBUG_NEW keeps track
of the filename and line number for each object that it allocates. Then,
when you use the DumpAllObjectsSince member function of class
CMemoryState, each object allocated with DEBUG_NEW is shown with the
filename and line number where it was allocated.
To use DEBUG_NEW, insert the define directive shown in the syntax line
above into your source files. Then wherever you use new, the
preprocessor will insert DEBUG_NEW, and the class library does the rest.
When you compile a release version of your program, DEBUG_NEW resolves
to a simple new operation, and the filename and line number information
is not generated.
NOTE: In Release mode, DEBUG_NEW is defined to be the standard operator
new, so you can leave DEBUG_NEW in your code.
-♦-