RFR: 8359936: StableValues can release the underlying function after complete computation [v4]
Viktor Klang
vklang at openjdk.org
Mon Aug 11 15:57:14 UTC 2025
On Tue, 22 Jul 2025 07:10:14 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes to release the underlying function if a stable function or collection has invoked its underlying supplier exhaustively so that it can be collected.
>>
>> This PR passes tier1, tier2, and tier3 testing on multiple platforms.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>
> Add a new method to StableValueImpl for improved speed
src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 174:
> 172: // Reduce the counter and if it reaches zero, clear the reference
> 173: // to the underlying holder.
> 174: underlyingHolder.countDown();
Doesn't the code here imply that if the underlying supplier/function etc throws an exception, the underlyingHolder won't get counted down, and will leak?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25878#discussion_r2267226348
More information about the core-libs-dev
mailing list