I am developing a memoryleak tool. In this i am overloading new and delete operator. Its working fine. But the code for which i am creating this tool is around 15000 lines. I cannot change the existing code only i can invoke the memoryleak tool function into the existing code. Existing code having stl containers (like list, map, stack etc). Stl container also call new and delete operator to allocate or deallocate memory. i want that stl container should call the new and delete operator which are in not the overloaded new and delete. for ex:
int *iptr = new int[10] ----> should call overloaded new[]
delete [] iptr -------------> should call overloaded delete[]
map.insert(10) -------------> should call default new[] ( which are in new.h)
map.erase() ---------------> should call default delete[] ( which are in new.h)
how can i do it? Any help would be aprreciated.
Sorry i forgot to mention that i am replacing new and delete with the following macros:
#define new DEBUG_NEW
#define DEBUG_NEW TrackMemory(__FILE__, __LINE__) ->* new
#define delete TrackDelete(__FILE__, __LINE__); delete
here TrackMemory is used to track memory and new is used to allocate memory same with delete. my tool also works fine but when stl containers comes into picture then it gives wrong result because they only use overloaded new. please help me out