Я использую следующий подход для предоставления new
информации о том, какой файл и строка выделяет каждый блок памяти:
void operator delete(void *p, const char* filename, int line);
void operator delete(void *p, const char* filename, int line, const std::nothrow_t&);
void operator delete[](void *p, const char* filename, int line);
void operator delete[](void *p, const char* filename, int line, const std::nothrow_t&);
void *operator new(std::size_t n, const char* filename, int line);
void *operator new(std::size_t n, const std::nothrow_t&, const char* filename, int line);
void *operator new[](std::size_t n, const char* filename, int line);
void *operator new[](std::size_t n, const std::nothrow_t&, const char* filename, int line);
#define new foo_new
#define foo_new new(__FILE__, __LINE__)