RFR: 8213269: convert test/hotspot/jtreg/runtime/memory/RunUnitTestsConcurrently to gtest [v6]
Kim Barrett
kbarrett at openjdk.java.net
Wed Mar 3 15:37:46 UTC 2021
On Wed, 3 Mar 2021 14:39:33 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>>> One question about this: where does it allocate memory for 't' ? Are the elements leaked here?
>>
>> Backing buffer for vector lives in C-heap. Its a dynamically growing array, basically like our GrowableArray. Only its not under our control and we cannot easily debug it if something goes wrong (take a look at the STL sources, they are not easy to understand). And it sidesteps our own os::malloc, so we cannot account it, and our guards won't work.
>>
>> Personally I would like to keep the test harness as simple stupid as possible, to avoid interfering with the actual test. Especially with tests which test memory allocation. I know that is a vague reason, but I also cannot find a bit advantage in using std::vector, compared with a simple calloced array. We dont need the dynamically-growing part here, we know right upfront how many threads we start, so its really a fixed sized array.
>
> Okay so you're right that we can't account in NMT and with our malloc guards for the memory that is allocated with std::vector, so I'm convinced that Misha should change this. Hopefully we can figure out how to make std::vector work in the future, because Misha's 2 lines for it look quite nice.
> Do you think using std:: would increase build times? My suspicion is that the Access barrier templates are to blame, but building hotspot is a fraction of building the whole jdk, which does seem to take a long time.
Using the C++ Standard Library has long been, and as yet remains, forbidden in HotSpot code. In particular, using standard containers hasn't played nicely with HotSpot's native memory tracking. A small number of uses of standard library facilities has crept into some of the gtests; I think jfr is the only "offender" at present. That shouldn't have been allowed, and there are some configuration and build kludges that were required to make that work.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2436
More information about the hotspot-dev
mailing list