提交 327d02ce 编写于 作者: P phh

6900899: vm fails to start when -Xmx value is less than OldSize + NewSize

Summary: Set minimum heap size to min(OldSize + NewSize, MaxHeapSize) in Arguments::set_heap_size().
Reviewed-by: kvn, ysr, tonyp
上级 2410fd55
...@@ -1378,9 +1378,15 @@ void Arguments::set_heap_size() { ...@@ -1378,9 +1378,15 @@ void Arguments::set_heap_size() {
// or -Xms, then set it as fraction of the size of physical memory, // or -Xms, then set it as fraction of the size of physical memory,
// respecting the maximum and minimum sizes of the heap. // respecting the maximum and minimum sizes of the heap.
if (FLAG_IS_DEFAULT(InitialHeapSize)) { if (FLAG_IS_DEFAULT(InitialHeapSize)) {
julong reasonable_minimum = (julong)(OldSize + NewSize);
reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
reasonable_minimum = os::allocatable_physical_memory(reasonable_minimum);
julong reasonable_initial = phys_mem / InitialRAMFraction; julong reasonable_initial = phys_mem / InitialRAMFraction;
reasonable_initial = MAX2(reasonable_initial, (julong)(OldSize + NewSize)); reasonable_initial = MAX2(reasonable_initial, reasonable_minimum);
reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
reasonable_initial = os::allocatable_physical_memory(reasonable_initial); reasonable_initial = os::allocatable_physical_memory(reasonable_initial);
...@@ -1388,14 +1394,10 @@ void Arguments::set_heap_size() { ...@@ -1388,14 +1394,10 @@ void Arguments::set_heap_size() {
if (PrintGCDetails && Verbose) { if (PrintGCDetails && Verbose) {
// Cannot use gclog_or_tty yet. // Cannot use gclog_or_tty yet.
tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial); tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
tty->print_cr(" Minimum heap size " SIZE_FORMAT, (uintx)reasonable_minimum);
} }
FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial); FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
set_min_heap_size((uintx)reasonable_minimum);
// Subsequent ergonomics code may expect min_heap_size to be set
// if InitialHeapSize is. Use whatever the current values are
// for OldSize and NewSize, whether or not they were set on the
// command line.
set_min_heap_size(OldSize + NewSize);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册