mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
Merge
This commit is contained in:
commit
262b1413c1
36 changed files with 1465 additions and 444 deletions
|
@ -264,6 +264,27 @@ void TwoGenerationCollectorPolicy::initialize_flags() {
|
|||
// need to do this again
|
||||
MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
|
||||
|
||||
// adjust max heap size if necessary
|
||||
if (NewSize + OldSize > MaxHeapSize) {
|
||||
if (FLAG_IS_CMDLINE(MaxHeapSize)) {
|
||||
// somebody set a maximum heap size with the intention that we should not
|
||||
// exceed it. Adjust New/OldSize as necessary.
|
||||
uintx calculated_size = NewSize + OldSize;
|
||||
double shrink_factor = (double) MaxHeapSize / calculated_size;
|
||||
// align
|
||||
NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
|
||||
// OldSize is already aligned because above we aligned MaxHeapSize to
|
||||
// max_alignment(), and we just made sure that NewSize is aligned to
|
||||
// min_alignment(). In initialize_flags() we verified that max_alignment()
|
||||
// is a multiple of min_alignment().
|
||||
OldSize = MaxHeapSize - NewSize;
|
||||
} else {
|
||||
MaxHeapSize = NewSize + OldSize;
|
||||
}
|
||||
}
|
||||
// need to do this again
|
||||
MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
|
||||
|
||||
always_do_update_barrier = UseConcMarkSweepGC;
|
||||
|
||||
// Check validity of heap flags
|
||||
|
@ -731,7 +752,7 @@ HeapWord* GenCollectorPolicy::satisfy_failed_allocation(size_t size,
|
|||
// free memory should be here, especially if they are expensive. If this
|
||||
// attempt fails, an OOM exception will be thrown.
|
||||
{
|
||||
IntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
|
||||
UIntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
|
||||
|
||||
gch->do_collection(true /* full */,
|
||||
true /* clear_all_soft_refs */,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue