8161079: Default heap size causes native memory exhaustion on 32 bit Windows
authormgerdin
Fri, 02 Sep 2016 16:45:16 +0200
changeset 40931 d4d2a4a0e023
parent 40930 3ef70f1039da
child 40932 cdc9d0ff3fa2
child 41066 e8c366069761
child 41070 496463b4e206
8161079: Default heap size causes native memory exhaustion on 32 bit Windows Reviewed-by: tschatzl, sjohanss
hotspot/src/os/windows/vm/os_windows.cpp
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Sep 07 23:17:24 2016 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Sep 02 16:45:16 2016 +0200
@@ -3796,6 +3796,11 @@
   GlobalMemoryStatusEx(&ms);
   _physical_memory = ms.ullTotalPhys;
 
+  if (FLAG_IS_DEFAULT(MaxRAM)) {
+    // Adjust MaxRAM according to the maximum virtual address space available.
+    FLAG_SET_DEFAULT(MaxRAM, MIN2(MaxRAM, (uint64_t) ms.ullTotalVirtual));
+  }
+
   OSVERSIONINFOEX oi;
   oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
   GetVersionEx((OSVERSIONINFO*)&oi);