I want to track all the memory(size allocated by std lib) allocated by all STL containers like map,list,vector etc. I just want to track STL container not regular object creation. Basically want to override new and delete of std lib.
Example
class demo {
public:
int i;
std::list<int> mylist;
}
int main() {
demo dd = new demo(); -> Don't want to track this. Just wan't to track
mylist(size of my list)
}
I found out that std has it's own allocator option. For example list has it is allocator
template < class T, class Alloc = allocator<T> > class list;
What is the default allocator if I don't defined anything. I have thousand of list and none of then has allocator and I don't want to change each one of them manually. So, what I was thinking if there is way where I can replace default allocator with mine.
How to do this ?
Aucun commentaire:
Enregistrer un commentaire