5/23/08

Explain DEBUG_NEW or what is the use of DEBUG_NEW ?

#define new DEBUG_NEW

Within each module of your application before you use the new operator to get more precise information. This step will cause your program to use DEBUG_NEW, a special version of the MFC new operator, which will also record line number and file name information for each allocation as it occurs. With this #define in place, any memory leak dumps will also include line number and source module name information for the allocation that caused the leak, thus helping you to pinpoint problems in your code.
In the release build, DEBUG_NEW reverts back to the normal new operator. Also note that, as of MFC 4.0, it uses the heap management from the C run-time library. This means that you can use the same debugging features in non-MFC applications.

No comments: