kucci / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Maps.capacity gives bad estimate (16) when expectedSize >= 2^30 #442

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Maps.capacity is used to give initial sizes to new hash maps and sets so that 
they can avoid expensive reallocations.  However, if the expected size is at 
least 2^30, then the computation overflows, and it ends up returning 16.

Original issue reported on code.google.com by ddlat...@gmail.com on 6 Oct 2010 at 9:47

GoogleCodeExporter commented 9 years ago
Nice catch!

Original comment by kurt.kluever on 7 Oct 2010 at 5:15

GoogleCodeExporter commented 9 years ago
This and many other integer-overflow bugs fixed for our collections when size 
nears max_value.

Original comment by kevinb@google.com on 24 Jan 2011 at 9:28

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09