diff src/share/vm/runtime/thread.cpp @ 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 5876f980ea19
children 716c64bda5ba
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp	Tue Aug 28 15:15:29 2012 +0200
+++ b/src/share/vm/runtime/thread.cpp	Wed Oct 17 17:36:48 2012 +0200
@@ -177,7 +177,8 @@
     const int alignment = markOopDesc::biased_lock_alignment;
     size_t aligned_size = size + (alignment - sizeof(intptr_t));
     void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC)
-                                          : os::malloc(aligned_size, flags, CURRENT_PC);
+                                          : AllocateHeap(aligned_size, flags, CURRENT_PC,
+                                              AllocFailStrategy::RETURN_NULL);
     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
@@ -191,7 +192,7 @@
     return aligned_addr;
   } else {
     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
-                       : os::malloc(size, flags, CURRENT_PC);
+                       : AllocateHeap(size, flags, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
   }
 }