Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 1074:84cb6f20afb3
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
author | phh |
---|---|
date | Fri, 20 Nov 2009 16:22:38 -0500 |
parents | fb4c00faa9da |
children | 40e7c1d24e4a e018e6884bd8 |
comparison
equal
deleted
inserted
replaced
1069:fb4c00faa9da | 1074:84cb6f20afb3 |
---|---|
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. |