--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Mar 28 10:27:28 2013 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Mar 27 19:21:18 2013 +0100
@@ -1552,6 +1552,15 @@
}
}
+julong Arguments::limit_by_allocatable_memory(julong limit) {
+ julong max_allocatable;
+ julong result = limit;
+ if (os::has_allocatable_memory_limit(&max_allocatable)) {
+ result = MIN2(result, max_allocatable / MaxVirtMemFraction);
+ }
+ return result;
+}
+
void Arguments::set_heap_size() {
if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
// Deprecated flag
@@ -1590,12 +1599,12 @@
}
reasonable_max = MIN2(reasonable_max, max_coop_heap);
}
- reasonable_max = os::allocatable_physical_memory(reasonable_max);
+ reasonable_max = limit_by_allocatable_memory(reasonable_max);
if (!FLAG_IS_DEFAULT(InitialHeapSize)) {
// An initial heap size was specified on the command line,
// so be sure that the maximum size is consistent. Done
- // after call to allocatable_physical_memory because that
+ // after call to limit_by_allocatable_memory because that
// method might reduce the allocation size.
reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize);
}
@@ -1615,14 +1624,14 @@
reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
- reasonable_minimum = os::allocatable_physical_memory(reasonable_minimum);
+ reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
julong reasonable_initial = phys_mem / InitialRAMFraction;
reasonable_initial = MAX2(reasonable_initial, reasonable_minimum);
reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
- reasonable_initial = os::allocatable_physical_memory(reasonable_initial);
+ reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
if (PrintGCDetails && Verbose) {
// Cannot use gclog_or_tty yet.
@@ -2608,9 +2617,7 @@
initHeapSize = MIN2(total_memory / (julong)2,
total_memory - (julong)160*M);
- // Make sure that if we have a lot of memory we cap the 32 bit
- // process space. The 64bit VM version of this function is a nop.
- initHeapSize = os::allocatable_physical_memory(initHeapSize);
+ initHeapSize = limit_by_allocatable_memory(initHeapSize);
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize);