8227168: Cleanup usage of NEW_C_HEAP_ARRAY

Reviewed-by: coleenp, dholmes, kbarrett, tschatzl
This commit is contained in:
Leo Korinth 2019-09-11 14:16:27 +02:00
parent a73f96ef60
commit eafb888c18
23 changed files with 73 additions and 89 deletions

View file

@ -503,12 +503,12 @@ CPUPerformanceInterface::CPUPerformance::CPUPerformance() {
}
bool CPUPerformanceInterface::CPUPerformance::initialize() {
size_t tick_array_size = (_counters.nProcs +1) * sizeof(os::Linux::CPUPerfTicks);
_counters.cpus = (os::Linux::CPUPerfTicks*)NEW_C_HEAP_ARRAY(char, tick_array_size, mtInternal);
size_t array_entry_count = _counters.nProcs + 1;
_counters.cpus = NEW_C_HEAP_ARRAY(os::Linux::CPUPerfTicks, array_entry_count, mtInternal);
if (NULL == _counters.cpus) {
return false;
}
memset(_counters.cpus, 0, tick_array_size);
memset(_counters.cpus, 0, array_entry_count * sizeof(*_counters.cpus));
// For the CPU load total
os::Linux::get_tick_information(&_counters.cpus[_counters.nProcs], -1);