8214272: Don't use memset to initialize arrays of MemoryUsage in memoryManager.cpp
Reviewed-by: rkennke, shade
--- 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;
--- 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();
}