I confirmed the leak and that the suggested fix works and should be safe. The idea for the test (using FFM to measure the number of handles in use) is quite neat too, and worked very well for me.
--------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - 8397801 Changes: https://git.openjdk.org/jdk/pull/34015/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34015&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8397801 Stats: 6 lines in 2 files changed: 5 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/34015.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/34015/head:pull/34015 PR: https://git.openjdk.org/jdk/pull/34015
