I have a test application that is associated with some DLL (or .so). In my main application, I defined a global new / delete like this:
void* operator new(size_t n) { .... } void operator delete(void* p) { ... }
But I noticed that statements are only called for the things that I highlight in my main application, but not if one of the DLLs does.
How to make a selection in a DLL through my new / delete statement? (This should also include the memory allocated by STL, so if one of the DLLs has std :: string, I would like my new operator to be called when the STL allocates its internal std :: string buffer).
I'm more interested in the Windows solution, but Linux will also be appreciated.
edit: maybe I was not clear at first, this test application that I did was designed to track memory usage for several automatically generated classes defined in a DLL. Creating my own distributor and using it in the generated STL code structures is not an option, all the more there are other non-STL distributions. But, seeing the answers, I think the best option is either to use the profiler, or just control the memory usage with perfmon.
source share