8226793: Replace OopStorage dup_name with os::strdup
Summary: Use os::strdup and os::free.
Reviewed-by: tschatzl
--- a/src/hotspot/share/gc/shared/oopStorage.cpp Thu Jul 04 17:02:19 2019 +0200
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp Thu Jul 04 13:26:41 2019 -0400
@@ -730,18 +730,12 @@
}
}
-const char* dup_name(const char* name) {
- char* dup = NEW_C_HEAP_ARRAY(char, strlen(name) + 1, mtGC);
- strcpy(dup, name);
- return dup;
-}
-
const size_t initial_active_array_size = 8;
OopStorage::OopStorage(const char* name,
Mutex* allocation_mutex,
Mutex* active_mutex) :
- _name(dup_name(name)),
+ _name(os::strdup(name)),
_active_array(ActiveArray::create(initial_active_array_size)),
_allocation_list(),
_deferred_updates(NULL),
@@ -784,7 +778,7 @@
Block::delete_block(*block);
}
ActiveArray::destroy(_active_array);
- FREE_C_HEAP_ARRAY(char, _name);
+ os::free(const_cast<char*>(_name));
}
// Managing service thread notifications.