#ifdef _DEBUG
inline void * __cdecl operator new(unsigned int size,
const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((DWORD)ptr, size, file, line);
return(ptr);
};
inline void __cdecl operator delete(void *p)
{
RemoveTrack((DWORD)p);
free(p);
};
#endif
But I''ve thought of a few problems...
1) The constructor isn''t called in the overriden new-operator...?
2) He says that "In addition to these, you may also need to override the new[] and delete[] operators as well. They are the same so I just left them out to save space". But they aren''t the same! So this Memory-Leak detector doesn''t detect mistakes like using delete instead of delete[]?
How do you detect memory leaks (preferably in DJGPP)?
Thanks for your time!
/Ksero
Detecting Memory Leaks
Hi everyone...
I''ve been trying to implement a memory leak tutorial over at flipcode... The idea is basically to override new and delete like this:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement