I'm just wondering whether there is a way in C++11 to get an exact estimation of the occupied memory for std::map (in bytes). For example:
std::map<int,int> m;
assume "m" has 10 elements, I want to know what the overall memory consumption is. In some posts I see the following rough estimation for this particular case:
size_t map_size = sizeof(std::map<int,int>) + m.size()*(sizeof(int)*2);
However, it does not consider the memory overhead per element, is it somehow measurable?! Thanks.
Aucun commentaire:
Enregistrer un commentaire