mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
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:
parent
69e7c05210
commit
8a690a1250
20 changed files with 82 additions and 36 deletions
|
@ -517,6 +517,14 @@ char *os::strdup(const char *str, MEMFLAGS flags) {
|
|||
return dup_str;
|
||||
}
|
||||
|
||||
char* os::strdup_check_oom(const char* str, MEMFLAGS flags) {
|
||||
char* p = os::strdup(str, flags);
|
||||
if (p == NULL) {
|
||||
vm_exit_out_of_memory(strlen(str) + 1, OOM_MALLOC_ERROR, "os::strdup_check_oom");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#define paranoid 0 /* only set to 1 if you suspect checking code has bug */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue