# HG changeset patch # User phh # Date 1258068337 28800 # Node ID da3df85c0bcd4c0d19e19da325a2ab43e2ddf692 # Parent 6571190a0304b9345b551728f8268cb259034e9a# Parent 0ad684e2769758662f0f023a3f7f74c127c45b53 Merge diff -r 6571190a0304 -r da3df85c0bcd src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Thu Nov 12 14:27:25 2009 -0800 +++ b/src/share/vm/runtime/arguments.cpp Thu Nov 12 15:25:37 2009 -0800 @@ -1373,13 +1373,19 @@ FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max); } - // If the initial_heap_size has not been set with InitialHeapSize, + // If the initial_heap_size has not been set with InitialHeapSize // or -Xms, then set it as fraction of the size of physical memory, // respecting the maximum and minimum sizes of the heap. 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; - reasonable_initial = MAX2(reasonable_initial, (julong)(OldSize + NewSize)); + reasonable_initial = MAX2(reasonable_initial, reasonable_minimum); reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); reasonable_initial = os::allocatable_physical_memory(reasonable_initial); @@ -1387,14 +1393,10 @@ if (PrintGCDetails && Verbose) { // Cannot use gclog_or_tty yet. 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); - - // 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); + set_min_heap_size((uintx)reasonable_minimum); } }