On Mon, 22 Jun 2026 08:15:15 GMT, Per Minborg <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java line 90:
>>
>>> 88: ConfinedSegmentPool.release(session.owner, poolSp);
>>> 89: }
>>> 90: session.resourceList.cleanup();
>>
>> Is it important for the release of the pool to be ordered before the
>> resource list cleanup? Why not just a simpler `super.close();` followed by
>> the pool release here? (Could you add a comment?)
>
> The reason is that the cleanup actions could throw. I will add a comment on
> that in the code.
Could we use try/finally? From my reading of the current code, `justClose` and
`cleanup` are not intended to be called outside of `MemorySessionImpl`, just
overridden. I think we should try to keep it that way (and keep `close()` being
the single source of truth for how the two interact).
Suggestion:
try {
super.close();
} finally {
if (pool > 0) {
ConfinedSegmentPool.release(session.owner, pool, poolSp);
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31365#discussion_r3806830370