hotspot/src/os/windows/vm/os_windows.cpp
changeset 16605 ba13efd453bc
parent 15927 f256c20146f4
child 16631 c6860a0ebc99
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Mar 28 10:27:28 2013 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Mar 27 19:21:18 2013 +0100
@@ -686,12 +686,17 @@
   return win32::physical_memory();
 }
 
-julong os::allocatable_physical_memory(julong size) {
+bool os::has_allocatable_memory_limit(julong* limit) {
+  MEMORYSTATUSEX ms;
+  ms.dwLength = sizeof(ms);
+  GlobalMemoryStatusEx(&ms);
 #ifdef _LP64
-  return size;
+  *limit = (julong)ms.ullAvailVirtual;
+  return true;
 #else
   // Limit to 1400m because of the 2gb address space wall
-  return MIN2(size, (julong)1400*M);
+  *limit = MIN2((julong)1400*M, (julong)ms.ullAvailVirtual);
+  return true;
 #endif
 }