RFR: 8344609: Check ResourceMark nesting when allocating a GrowableArray on an alternative ResourceArea
Martin Doerr
mdoerr at openjdk.org
Wed Nov 27 10:47:40 UTC 2024
On Wed, 20 Nov 2024 10:01:24 GMT, Richard Reingruber <rrich 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.
I think this enhancement is helpful to find arena usage bugs.
src/hotspot/share/utilities/growableArray.cpp line 78:
> 76:
> 77: void GrowableArrayNestingCheck::on_arena_alloc(Arena* arena) const {
> 78: if ((arena->get_tag() == Arena::Tag::tag_ra) && _nesting != static_cast<ResourceArea*>(arena)->nesting()) {
The first comparison uses braces, the second one doesn't. You may want to make that consistent.
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"?
-------------
Marked as reviewed by mdoerr (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22269#pullrequestreview-2464648151
PR Review Comment: https://git.openjdk.org/jdk/pull/22269#discussion_r1860428094
PR Review Comment: https://git.openjdk.org/jdk/pull/22269#discussion_r1860429634
More information about the hotspot-dev
mailing list