RFR: 8344609: Check ResourceMark nesting when allocating a GrowableArray on an alternative ResourceArea

Richard Reingruber rrich at openjdk.org
Wed Nov 27 10:53:41 UTC 2024


On Wed, 27 Nov 2024 10:42:52 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> With this change the GrowableArray nesting check is also performed if allocating from an `Arena` which in fact is a `ResourceArea`.
>> 
>> The additional checking can help find issue as [JDK-8328085](https://bugs.openjdk.org/browse/JDK-8328085).
>> 
>> More testing is pending.
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22269#discussion_r1860442200


More information about the hotspot-dev mailing list