6424123: JVM crashes on failed 'strdup' call

Calling os::malloc()/os::strdup() and new os::strdup_check_oom() instead of ::malloc()/::strdup() for native memory tracking purpose

Reviewed-by: coleenp, ctornqvi, kvn
This commit is contained in:
Zhengyu Gu 2014-08-11 10:18:09 -07:00
parent 69e7c05210
commit 8a690a1250
20 changed files with 82 additions and 36 deletions

View file

@ -52,6 +52,7 @@
#include "interpreter/bytecodes.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/cardTableRS.hpp"
#include "memory/defNewGeneration.hpp"
#include "memory/freeBlockDictionary.hpp"
@ -93,6 +94,7 @@
#include "runtime/globals.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/os.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/serviceThread.hpp"
#include "runtime/sharedRuntime.hpp"
@ -3296,14 +3298,14 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
}
}
if (strstr(typeName, " const") == typeName + len - 6) {
char * s = strdup(typeName);
char * s = os::strdup_check_oom(typeName);
s[len - 6] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) {
free(s);
os::free(s);
return 1;
}
free(s);
os::free(s);
}
if (!isRecurse) {
tty->print_cr("type \"%s\" not found", typeName);