-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b63
-
generic
-
generic
PriorityQueue.grow has this code:
if (newlen >= Integer.MAX_VALUE / 2) // avoid overflow
newlen = Integer.MAX_VALUE;
else
newlen <<= 2;
That shift grows by 4. The intended action was certainly
newlen <<= 1;
The current code fails when the internal array is between
Integer.MAX_VALUE/4 and Integer.MAX_VALUE/2,
and is needlessly wasteful of memory in other cases.
if (newlen >= Integer.MAX_VALUE / 2) // avoid overflow
newlen = Integer.MAX_VALUE;
else
newlen <<= 2;
That shift grows by 4. The intended action was certainly
newlen <<= 1;
The current code fails when the internal array is between
Integer.MAX_VALUE/4 and Integer.MAX_VALUE/2,
and is needlessly wasteful of memory in other cases.