How can i estimate memory usage of std::map?

前端 未结 7 707
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 03:06

For example, I have a std::map with known sizeof(A) and sizeof(B), while map has N entries inside. How would you estimate its memory usage? I\'d say it\'s something like

7条回答
  •  野性不改
    2020-11-29 03:46

    The size of the map really depends on the implementation of the map. You might have different sizes on different compilers/platforms, depending on which STL implementation they are providing.

    Why do you need this size?

提交回复
热议问题