RFR: 8344609: Check ResourceMark nesting when allocating a GrowableArray on an alternative ResourceArea [v3]
Richard Reingruber
rrich at openjdk.org
Wed Dec 4 07:29:49 UTC 2024
On Wed, 27 Nov 2024 10:50:45 GMT, Richard Reingruber <rrich at openjdk.org> wrote:
>> src/hotspot/share/utilities/growableArray.cpp line 79:
>>
>>> 77: void GrowableArrayNestingCheck::on_arena_alloc(Arena* arena) const {
>>> 78: if ((arena->get_tag() == Arena::Tag::tag_ra) && _nesting != static_cast<ResourceArea*>(arena)->nesting()) {
>>> 79: fatal("allocation bug: GrowableArray is growing within nested ResourceMark");
>>
>> Should it say "could grow"?
>
> It *is* growing since the check is done when allocating to accommodate more array elements. And the RM nesting is different now than when the array was created.
Should be a little more specific: [a new `_data` array is allocated](https://github.com/openjdk/jdk/blob/4b928167435bbf41dd00425c927da761751ca704/src/hotspot/share/utilities/growableArray.hpp#L526-L530) in the scope of a nested RM. Existing array elements are copied to the new `_data` array.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22269#discussion_r1868842375
More information about the hotspot-dev
mailing list