7036747: 7017009 reappeared, problem with ElfStringTable

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
This commit is contained in:
Zhengyu Gu 2011-04-27 09:09:57 -04:00
parent 3c4d3002f2
commit 865413485d
4 changed files with 20 additions and 7 deletions

View file

@ -44,6 +44,14 @@ void* CHeapObj::operator new(size_t size){
return (void *) AllocateHeap(size, "CHeapObj-new");
}
void* CHeapObj::operator new (size_t size, const std::nothrow_t& nothrow_constant) {
char* p = (char*) os::malloc(size);
#ifdef ASSERT
if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
#endif
return p;
}
void CHeapObj::operator delete(void* p){
FreeHeap(p);
}