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
|
@ -629,10 +629,16 @@ class vmNode : public ProfilerNode {
|
|||
}
|
||||
|
||||
vmNode(const char* name, const TickPosition where) : ProfilerNode() {
|
||||
_name = name;
|
||||
_name = os::strdup(name);
|
||||
update(where);
|
||||
}
|
||||
|
||||
~vmNode() {
|
||||
if (_name != NULL) {
|
||||
os::free((void*)_name);
|
||||
}
|
||||
}
|
||||
|
||||
const char *name() const { return _name; }
|
||||
bool is_compiled() const { return true; }
|
||||
|
||||
|
@ -784,7 +790,7 @@ void ThreadProfiler::vm_update(const char* name, TickPosition where) {
|
|||
assert(index >= 0, "Must be positive");
|
||||
// Note that we call strdup below since the symbol may be resource allocated
|
||||
if (!table[index]) {
|
||||
table[index] = new (this) vmNode(os::strdup(name), where);
|
||||
table[index] = new (this) vmNode(name, where);
|
||||
} else {
|
||||
ProfilerNode* prev = table[index];
|
||||
for(ProfilerNode* node = prev; node; node = node->next()) {
|
||||
|
@ -794,7 +800,7 @@ void ThreadProfiler::vm_update(const char* name, TickPosition where) {
|
|||
}
|
||||
prev = node;
|
||||
}
|
||||
prev->set_next(new (this) vmNode(os::strdup(name), where));
|
||||
prev->set_next(new (this) vmNode(name, where));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue