Boost logo

Boost Users :

Subject: Re: [Boost-users] Memory usage of boost::unordered_multimap and boost::unordered_multimap
From: Daniel James (dnljms_at_[hidden])
Date: 2017-10-06 11:49:45


On 6 October 2017 at 11:41, Joaquin M López Muñoz via Boost-users
<boost-users_at_[hidden]> wrote:
> El 06/10/2017 a las 12:16, Ram via Boost-users escribió:
>>
>> Hi,
>>
>> I need help in determining the amount of memory used by
>> boost::unordered_multimap and boost::unordered_multimap.
>
>
> From a theoretical point of view, this might help:
>
> http://bannalia.blogspot.com/2013/10/implementation-of-c-unordered.html

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 list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net