hotspot/src/share/vm/runtime/arguments.cpp
changeset 4444 877bb3341a10
parent 4439 dfe376b4f7df
child 4560 b6f7db60cb24
child 4574 b2d5b0975515
equal deleted inserted replaced
4439:dfe376b4f7df 4444:877bb3341a10
  1376 
  1376 
  1377   // If the initial_heap_size has not been set with InitialHeapSize
  1377   // If the initial_heap_size has not been set with InitialHeapSize
  1378   // or -Xms, then set it as fraction of the size of physical memory,
  1378   // or -Xms, then set it as fraction of the size of physical memory,
  1379   // respecting the maximum and minimum sizes of the heap.
  1379   // respecting the maximum and minimum sizes of the heap.
  1380   if (FLAG_IS_DEFAULT(InitialHeapSize)) {
  1380   if (FLAG_IS_DEFAULT(InitialHeapSize)) {
       
  1381     julong reasonable_minimum = (julong)(OldSize + NewSize);
       
  1382 
       
  1383     reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
       
  1384 
       
  1385     reasonable_minimum = os::allocatable_physical_memory(reasonable_minimum);
       
  1386 
  1381     julong reasonable_initial = phys_mem / InitialRAMFraction;
  1387     julong reasonable_initial = phys_mem / InitialRAMFraction;
  1382 
  1388 
  1383     reasonable_initial = MAX2(reasonable_initial, (julong)(OldSize + NewSize));
  1389     reasonable_initial = MAX2(reasonable_initial, reasonable_minimum);
  1384     reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
  1390     reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
  1385 
  1391 
  1386     reasonable_initial = os::allocatable_physical_memory(reasonable_initial);
  1392     reasonable_initial = os::allocatable_physical_memory(reasonable_initial);
  1387 
  1393 
  1388     if (PrintGCDetails && Verbose) {
  1394     if (PrintGCDetails && Verbose) {
  1389       // Cannot use gclog_or_tty yet.
  1395       // Cannot use gclog_or_tty yet.
  1390       tty->print_cr("  Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
  1396       tty->print_cr("  Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
       
  1397       tty->print_cr("  Minimum heap size " SIZE_FORMAT, (uintx)reasonable_minimum);
  1391     }
  1398     }
  1392     FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
  1399     FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
  1393 
  1400     set_min_heap_size((uintx)reasonable_minimum);
  1394     // Subsequent ergonomics code may expect min_heap_size to be set
       
  1395     // if InitialHeapSize is.  Use whatever the current values are
       
  1396     // for OldSize and NewSize, whether or not they were set on the
       
  1397     // command line.
       
  1398     set_min_heap_size(OldSize + NewSize);
       
  1399   }
  1401   }
  1400 }
  1402 }
  1401 
  1403 
  1402 // This must be called after ergonomics because we want bytecode rewriting
  1404 // This must be called after ergonomics because we want bytecode rewriting
  1403 // if the server compiler is used, or if UseSharedSpaces is disabled.
  1405 // if the server compiler is used, or if UseSharedSpaces is disabled.