RFR: JDK-8303605: Memory leaks in Metaspace gtests

Thomas Stuefe stuefe at openjdk.org
Sat Mar 4 09:36:04 UTC 2023


On Fri, 3 Mar 2023 19:40:40 GMT, Justin King <jcking at openjdk.org> wrote:

> Fix memory leaks identified while running Metaspace gtests.

Mostly good, small nits remain.

test/hotspot/gtest/metaspace/test_freeblocks.cpp line 103:

> 101:       DEBUG_ONLY(_freeblocks.verify();)
> 102:     }
> 103:   }

Can you reshape this a bit pls: let deallocate_top return bool (false if nothing removed) and do

void deallocate_all() {
  while (!deallocate_top());
}

test/hotspot/gtest/metaspace/test_virtualspacenode.cpp line 506:

> 504: 
> 505:   VirtualSpaceNode* node = VirtualSpaceNode::create_node(word_size, &cl, &sres, &scomm);
> 506: 

please remove whitespace change

test/hotspot/gtest/metaspace/test_virtualspacenode.cpp line 543:

> 541:   DEBUG_ONLY(node->verify_locked();)
> 542: 
> 543:   delete node;

Can you please add an ASSERT after the delete to test that sres and scomm are 0?

-------------

Changes requested by stuefe (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12865


More information about the hotspot-runtime-dev mailing list