RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size (original) (raw)

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Jul 8 01:12:37 UTC 2014


On 08.07.2014 4:47, Martin Buchholz wrote:

I think this code has an off-by-factor-of-2 bug.

+ if (expectedMaxSize > MAXIMUMCAPACITY / 3) + return MAXIMUMCAPACITY;

No, even though it looks like a bug.

(MAXIMUM_CAPACITY / 3) * (3 / 2) == MAXIMUM_CAPACITY / 2.

if expected size > MAXIMUM_CAPACITY / 3, then the minimum capacity must be > MAXIMUM_CAPACITY / 2 then the minimum capacity == MAXIMUM_CAPACITY.



More information about the core-libs-dev mailing list