# HG changeset patch # User dchuyko # Date 1543400696 -10800 # Node ID 263c7685a22a1323ae5b4f56ca6504f3d00e2421 # Parent b22da519f2e3223fca4e0b3561e721cece8e7493 8214272: Don't use memset to initialize arrays of MemoryUsage in memoryManager.cpp Reviewed-by: rkennke, shade diff -r b22da519f2e3 -r 263c7685a22a src/hotspot/share/opto/matcher.cpp --- a/src/hotspot/share/opto/matcher.cpp Wed Nov 28 11:06:27 2018 +0100 +++ b/src/hotspot/share/opto/matcher.cpp Wed Nov 28 13:24:56 2018 +0300 @@ -1208,9 +1208,7 @@ // Allocate a private array of RegMasks. These RegMasks are not shared. msfpt->_in_rms = NEW_RESOURCE_ARRAY( RegMask, cnt ); // Empty them all. - for (uint i = 0; i < cnt; i++) { - msfpt->_in_rms[i] = RegMask(); - } + for (uint i = 0; i < cnt; i++) ::new (&(msfpt->_in_rms[i])) RegMask(); // Do all the pre-defined non-Empty register masks msfpt->_in_rms[TypeFunc::ReturnAdr] = _return_addr_mask; diff -r b22da519f2e3 -r 263c7685a22a src/hotspot/share/services/memoryManager.cpp --- a/src/hotspot/share/services/memoryManager.cpp Wed Nov 28 11:06:27 2018 +0100 +++ b/src/hotspot/share/services/memoryManager.cpp Wed Nov 28 13:24:56 2018 +0300 @@ -168,9 +168,8 @@ _index = 0; _start_time = 0L; _end_time = 0L; - size_t len = _usage_array_size * sizeof(MemoryUsage); - memset(_before_gc_usage_array, 0, len); - memset(_after_gc_usage_array, 0, len); + for (int i = 0; i < _usage_array_size; i++) ::new (&_before_gc_usage_array[i]) MemoryUsage(); + for (int i = 0; i < _usage_array_size; i++) ::new (&_after_gc_usage_array[i]) MemoryUsage(); }