@brx With your solution the user need to type () after the delete but the most delete calls are without them.
Here is my solution (which I'll correct in my last post):
#define DEL_OLD delete
#define delete if(PassDeleteParams(__FILE__, __LINE__)); else DEL_OLD
The problem now is more complex - the threads in the program can assign dynamicly created object on an global variables like this:
char* String;
unsigned long __stdcall Thread1 (void* lp)
{
String=new char[50];
#ifdef DEBUG
EndThreadMemCheck();
#endif
return 0;
}
In this case it will give an error for an memory leak and when I delete it from the main thread it will give me message for an invalid delete call. Any suggestions to avoid this?