Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/allocation.cpp @ 3302:2a3da7eaf4a6
7036747: 7017009 reappeared, problem with ElfStringTable
Summary: Created new "new" operator for CHeapObj that allows malloc to fail without causing fatal error. Also replaced "HeapAllocate" with "os::malloc" in decoder code to allow decoder to handle low memory scenario.
Reviewed-by: coleenp, dholmes
author | zgu |
---|---|
date | Wed, 27 Apr 2011 09:09:57 -0400 |
parents | 4a9604cd7c5f |
children | f08d439fab8c |
comparison
equal
deleted
inserted
replaced
2477:3449f5e02cc4 | 3302:2a3da7eaf4a6 |
---|---|
42 | 42 |
43 void* CHeapObj::operator new(size_t size){ | 43 void* CHeapObj::operator new(size_t size){ |
44 return (void *) AllocateHeap(size, "CHeapObj-new"); | 44 return (void *) AllocateHeap(size, "CHeapObj-new"); |
45 } | 45 } |
46 | 46 |
47 void* CHeapObj::operator new (size_t size, const std::nothrow_t& nothrow_constant) { | |
48 char* p = (char*) os::malloc(size); | |
49 #ifdef ASSERT | |
50 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p); | |
51 #endif | |
52 return p; | |
53 } | |
54 | |
47 void CHeapObj::operator delete(void* p){ | 55 void CHeapObj::operator delete(void* p){ |
48 FreeHeap(p); | 56 FreeHeap(p); |
49 } | 57 } |
50 | 58 |
51 void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; | 59 void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; |