Memory usage of boost::unordered_multimap and boost::unordered_multimap

Memory usage of boost::unordered_multimap and boost::unordered_multimap

Hi,

I need help in determining the amount of memory used by boost::unordered_multimap and boost::unordered_multimap. We have a large code base and we have some optimizations done using boost::unordered_multimap and boost::unordered_multimap. The speed it really good, but we want to measure the amount of space it is occupying.

I need help in determining the amount of memory used by boost::unordered_multimap and boost::unordered_multimap. We have a large code base and we have some optimizations done using boost::unordered_multimap and boost::unordered_multimap. The speed it really good, but we want to measure the amount of space it is occupying.

Thanks Joaquin! That was very helpful! But I am trying to find out the size it occupies since we see a heap growth in our application. I want to rule out the possiblity of the growth being because of the unordered_map and the unordered_multimap.

Can I use the method I mentioned in the previous mail? Or would a profiler help? An approximate number would do.

The implementation has changed recently, C++17 requires that
unordered_map and unordered_multimap use the same nodes, so now the
unordered_multimap nodes are a little smaller, and a bit slower when
there are a lot of elements with equivalent keys as it has to iterate
through them one by one. I also now store the bucket index in nodes
instead of the hash value.

The container still allocates an array of (bucket_count + 1) buckets,
and each node consists of the value, a std::size_t, and a pointer, and
also whatever housekeeping is required for memory management. This can
be quite costly compared to storing values in an array.
_______________________________________________
Boost-users mailing list
[hidden email]https://lists.boost.org/mailman/listinfo.cgi/boost-users