RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

Rémi Forax forax at openjdk.org
Mon Jul 15 11:33:30 UTC 2024


On Mon, 15 Jul 2024 10:50:34 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This is what I was thinking of as well. close() on a shared arena can be called by any thread, so it would be possible to have an executor service with 1-n threads that is dedicated to closing memory.

This delays both the closing of the Arena and the freeing of the segments, so bugs may be not discovered if the arena is accessed in between the time the thread pool is notified and the time the close() is effectively called.

And you loose the structured part of the API, you can not use a try-with-resources anymore. I think that part can be fixed using a wrapper on top of Arena.ofShared().

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

PR Comment: https://git.openjdk.org/jdk/pull/20158#issuecomment-2228280373


More information about the core-libs-dev mailing list