changeset 55592:fd1a4c4b7616

8226793: Replace OopStorage dup_name with os::strdup Summary: Use os::strdup and os::free. Reviewed-by: tschatzl
author kbarrett
date Thu, 04 Jul 2019 13:26:41 -0400
parents 9523b841b470
children 963924f1c891
files src/hotspot/share/gc/shared/oopStorage.cpp
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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.