< prev index next >

src/hotspot/share/adlc/arena.cpp

Print this page

        

@@ -22,10 +22,18 @@
  *
  */
 
 #include "adlc.hpp"
 
+void* AllocateHeap(size_t size, AllocFailType alloc_fail_mode) {
+  unsigned char* ptr = (unsigned char*) malloc(size);
+  if (ptr == NULL && size != 0 && alloc_fail_mode == AllocFailStrategy::EXIT_OOM) {
+    exit(1);
+  }
+  return ptr;
+}
+
 void* Chunk::operator new(size_t requested_size, size_t length) throw() {
   return CHeapObj::operator new(requested_size + length);
 }
 
 void  Chunk::operator delete(void* p, size_t length) {

@@ -162,11 +170,11 @@
 
 //-----------------------------------------------------------------------------
 // CHeapObj
 
 void* CHeapObj::operator new(size_t size) throw() {
-  return (void *) malloc(size);
+  return (void *) AllocateHeap(size);
 }
 
 void CHeapObj::operator delete(void* p){
  free(p);
 }
< prev index next >