8161079: Default heap size causes native memory exhaustion on 32 bit Windows
Reviewed-by: tschatzl, sjohanss
--- 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);