What is the maximum size of hashmap/map object in c++ and java? I want to use hashmap, but i am working on huge data. I am worrying if i use this on large data, it may crash because of its capacity limit. Is that so? If so, what can be the alternative way?
In Java, the size()
of a HashMap
is of type int
, so there's an upper bound of 2^31-1 elements in the map.
In C++, map::max_size
returns the max. number of elements. In a vanilla map
, there's an upper bound of at most SIZE_T_MAX
elements, which is 2^64-1 on modern hardware.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With