RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v4]

Alan Bateman alanb at openjdk.org
Mon Nov 21 16:37:33 UTC 2022


On Mon, 21 Nov 2022 16:08:20 GMT, Per Minborg <pminborg at 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



More information about the security-dev mailing list