src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page

        

*** 1672,1681 **** --- 1672,1689 ---- assert(minimum_desired_capacity <= maximum_desired_capacity, err_msg("minimum_desired_capacity = " SIZE_FORMAT ", " "maximum_desired_capacity = " SIZE_FORMAT, minimum_desired_capacity, maximum_desired_capacity)); + // Make sure that we will be able to allocate word_size words memory + // after gc - JDK-8130265. + // Adjust minimum_desired_capacity and maximum_desired_capacity accordingly + size_t bytes_to_allocate = word_size * HeapWordSize; + size_t aligned_bytes_to_allocate = align_size_up(bytes_to_allocate, HeapRegion::GrainBytes); + minimum_desired_capacity += aligned_bytes_to_allocate; + maximum_desired_capacity += aligned_bytes_to_allocate; + // Should not be greater than the heap max size. No need to adjust // it with respect to the heap min size as it's a lower bound (i.e., // we'll try to make the capacity larger than it, not smaller). minimum_desired_capacity = MIN2(minimum_desired_capacity, max_heap_size); // Should not be less than the heap min size. No need to adjust it