diff src/share/vm/memory/resourceArea.hpp @ 6872:7b5885dadbdc

8000617: It should be possible to allocate memory without the VM dying. Reviewed-by: coleenp, kamg
author nloodin
date Wed, 17 Oct 2012 17:36:48 +0200
parents d2a62e0f25eb
children 716c64bda5ba
line wrap: on
line diff
--- a/src/share/vm/memory/resourceArea.hpp	Tue Aug 28 15:15:29 2012 +0200
+++ b/src/share/vm/memory/resourceArea.hpp	Wed Oct 17 17:36:48 2012 +0200
@@ -68,7 +68,7 @@
     debug_only(_nesting = 0;);
   }
 
-  char* allocate_bytes(size_t size) {
+  char* allocate_bytes(size_t size, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
 #ifdef ASSERT
     if (_nesting < 1 && !_warned++)
       fatal("memory leak: allocating without ResourceMark");
@@ -78,7 +78,7 @@
       return (*save = (char*)os::malloc(size, mtThread));
     }
 #endif
-    return (char*)Amalloc(size);
+    return (char*)Amalloc(size, alloc_failmode);
   }
 
   debug_only(int nesting() const { return _nesting; });