Mercurial > hg > truffle
diff src/share/vm/utilities/elfStringTable.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 | 2d4762ec74af |
children | f08d439fab8c |
line wrap: on
line diff
--- a/src/share/vm/utilities/elfStringTable.cpp Tue Apr 12 14:18:53 2011 -0700 +++ b/src/share/vm/utilities/elfStringTable.cpp Wed Apr 27 09:09:57 2011 -0400 @@ -27,6 +27,7 @@ #ifndef _WINDOWS #include "memory/allocation.inline.hpp" +#include "runtime/os.hpp" #include "utilities/elfStringTable.hpp" // We will try to load whole string table into memory if we can. @@ -41,14 +42,14 @@ // try to load the string table long cur_offset = ftell(file); - m_table = (char*)NEW_C_HEAP_ARRAY(char, shdr.sh_size); + m_table = (char*)os::malloc(sizeof(char) * shdr.sh_size); if (m_table != NULL) { // if there is an error, mark the error if (fseek(file, shdr.sh_offset, SEEK_SET) || fread((void*)m_table, shdr.sh_size, 1, file) != 1 || fseek(file, cur_offset, SEEK_SET)) { m_status = Decoder::file_invalid; - FREE_C_HEAP_ARRAY(char, m_table); + os::free((void*)m_table); m_table = NULL; } } else { @@ -58,7 +59,7 @@ ElfStringTable::~ElfStringTable() { if (m_table != NULL) { - FREE_C_HEAP_ARRAY(char, m_table); + os::free((void*)m_table); } if (m_next != NULL) {