EVALUATION
There were a few bugs in the code that calculated whether to grow or shrink the heap and by how much after a Full GC (that's where the failing assert is).
a) minimum_desired_capacity was adjusted not to be lower than the min heap size:
> minimum_desired_capacity =
> MAX2(minimum_desired_capacity,
> collector_policy()->initial_heap_byte_size());
whereas we should adjust it not to be greater than the max heap size. minimum_desired_capacity is a lower bound. If it falls below the min heap size, it will by default be lower than the current capacity (given that the current capacity should be greater than or equal to the min heap size), so the current capacity will not need to be adjusted. However, we should not try to increase the current capacity passed the max heap size.
b) The assert that fires is in the wrong place. It's placed after the minimum_desired_capacity is adjusted according to the max heap size and maximum_desired_capacity is adjusted according to the min heap size and at that point the condition does not hold. The condition should be checked before the adjustment.
c) The calculations for minimum_desired_capacity and maximum_desired_capacity could overflow 32-bit size_t's.
|