< prev index next >
src/hotspot/share/adlc/arena.cpp
Print this page
@@ -22,10 +22,20 @@
*
*/
#include "adlc.hpp"
+void* AllocateHeap(size_t size) {
+ unsigned char* ptr = (unsigned char*) malloc(size);
+ if (ptr == NULL && size != 0) {
+ fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash!
+ fflush(stderr);
+ 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 +172,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 >