On Mon, 21 Nov 2022 16:08:20 GMT, Per Minborg <pminb...@openjdk.org> wrote:
> Although this looks much simpler and concise, it means "a new object is > created for each invocation" My comment was actually to see if DirectBuffer could extend AutoCloseable so that the acquire returns "this" for the non-session case. Doing the equivalent for the session case might leak into MemorySessionImpl implementing DirectBuffer which you probably don't want to do. If NOP_CLOSE.close can do the Reference.reachabilityFence(this) then it would at least improve some of the use-sites. ------------- PR: https://git.openjdk.org/jdk/pull/11260