Memory Tracking in C++
When using C, it's very easy to make your own memory tracking system. You just macro over the malloc functions and allocate a bit of extra memory for your own linked list and file name/line numbers.
I've been thinking of extending my existing C memory tracking system to act upon the C++ within my programmes.
It appears to be relatively simple to overload the base C++ new and delete functions, by simply including replacement functions within the programme.
However, does anyone know how this affects things outside of your own code? DLLs will have their own memory pages, etc, and shouldn't be affected, but what about static libraries linked into your programme? What if those static libraries have already overloaded the new/delete operators?
Bare in mind I haven't actually tried overloading the globals yet! I'm just wondering whether it is an avenue worth exploring.
Thanks!
I've been thinking of extending my existing C memory tracking system to act upon the C++ within my programmes.
It appears to be relatively simple to overload the base C++ new and delete functions, by simply including replacement functions within the programme.
However, does anyone know how this affects things outside of your own code? DLLs will have their own memory pages, etc, and shouldn't be affected, but what about static libraries linked into your programme? What if those static libraries have already overloaded the new/delete operators?
Bare in mind I haven't actually tried overloading the globals yet! I'm just wondering whether it is an avenue worth exploring.
Thanks!
