8235346: [Redo] 8235247: WorkerDataArray leaks C heap memory for associated work items

Fix gtest after last iteration to acknowledge correct ownership of sub-WorkerDataArrays.

Reviewed-by: lkorinth, sjohanss
This commit is contained in:
Thomas Schatzl 2019-12-06 09:49:57 +01:00
parent 5decc88da4
commit 02dad379ee
2 changed files with 5 additions and 4 deletions
src/hotspot/share/gc/shared
test/hotspot/gtest/gc/shared

@ -59,6 +59,9 @@ T WorkerDataArray<T>::get(uint worker_i) const {
template <typename T>
WorkerDataArray<T>::~WorkerDataArray() {
for (uint i = 0; i < MaxThreadWorkItems; i++) {
delete _thread_work_items[i];
}
FREE_C_HEAP_ARRAY(T, _data);
}

@ -35,10 +35,9 @@ class WorkerDataArrayTest : public ::testing::Test {
WorkerDataArrayTest() :
title("Test array"),
array(3, title),
sub_item_title("Sub item array"),
sub_item(3, sub_item_title) {
sub_item_title("Sub item array") {
array.link_thread_work_items(&sub_item);
array.link_thread_work_items(new WorkerDataArray<size_t>(3, sub_item_title));
}
const char* print_summary() {
@ -70,7 +69,6 @@ class WorkerDataArrayTest : public ::testing::Test {
WorkerDataArray<T> array;
const char* sub_item_title;
WorkerDataArray<size_t> sub_item;
private:
virtual const char* expected_summary() = 0;