RFR: 8213269: convert test/hotspot/jtreg/runtime/memory/RunUnitTestsConcurrently to gtest [v6]

Mikhailo Seledtsov mseledtsov at openjdk.java.net
Tue Mar 2 23:57:01 UTC 2021


On Tue, 2 Mar 2021 22:00:59 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Mikhailo Seledtsov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Using regular brackets in initializer list instead of curly brackets
>
> test/hotspot/gtest/concurrent_test_runner.inline.hpp line 74:
> 
>> 72:     Semaphore done(0);
>> 73: 
>> 74:     std::vector<UnitTestThread*> t;
> 
> Regarding the STL question, I think using std in a limited fashion in the tests seems ok before we start allowing it in the main sources, despite where Misha pointed out it already exists.  It's going to be allowed pretty soon anyway.
> One question about this: where does it allocate memory for 't' ?  Are the elements leaked here?

On a question: where does it allocate memory for 't' ? Are the elements leaked here?
The vector will allocate and free the memory for the containers (the memory containing pointers to UnitTestThread). 

As for the UnitTestThread objects/instances themselves:
- JavaTestThread. I checked couple of other examples of uses of JavaTestThread (test_symbolTable.cpp and oops/test_markWord.cpp), and neither is calling explicit delete on the objects of this type
- I presume the thread will free its resources once it exits (and we wait for done semafore to ensure this)
- adding code “delete t[i]” results in crash, presuming due to freeing an already released memory

Hence, I believe, no changes needed to this code to free resources.

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

PR: https://git.openjdk.java.net/jdk/pull/2436


More information about the hotspot-dev mailing list