The hook receives the file name and line number only if the source file
that called 'new' or malloc was set up to use the debug versions of
'operator new' and malloc and pass them this information.
This can be done in the following way:
1) Usually in the precompiled header file:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, THIS_FILE, __LINE__)
2) At the beginning of every source file with memory allocations:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@nv3 - I guess you mean this right? Even after doing this I am not able to recieve the filename and linenumber in the parameters. Can you please help me with this compilation under _DEBUG thing in detail. You are right i need it for memory leaks.