RFR: 8355013: GrowableArray default constructor should not allocate [v2]

Kim Barrett kbarrett at openjdk.org
Mon Apr 21 16:31:50 UTC 2025


On Fri, 18 Apr 2025 08:44:58 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> test/hotspot/gtest/utilities/test_growableArray.cpp line 446:
>> 
>>> 444: // static empty vector
>>> 445: const GrowableArray<int> empty_array(mtTest);
>>> 446: const GrowableArrayCHeap<int, mtTest> empty_cheap_array;
>> 
>> Where are these used?
>
> Thanks for your reviews, these are additional to ensure that `GrowableArray` instances can be created in static context. I have added a test to check these are truly empty.

HotSpot denigrates non-local objects with non-trivial ctors.  We shouldn't have such instances.
https://github.com/openjdk/jdk/blame/4dd64b49716144cc697fb461ff88860e2cbcaaea/doc/hotspot-style.md#L1200-L1205
See also https://github.com/openjdk/jdk/pull/24689

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24748#discussion_r2052683571


More information about the hotspot-dev mailing list