On Wed, 21 May 2025 17:55:17 GMT, Valerie Peng <valer...@openjdk.org> wrote:
>> src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java >> line 459: >> >>> 457: >>> 458: boolean pending = false; >>> 459: NIO_ACCESS.acquireSession(buf); >> >> Here, we acquire the session *after* we have obtained the address. This is >> safe as we do not touch the segment before it is acquired. If a segment is >> deallocated before we try to acquire the session, an exception will be >> thrown. > > Is there documentation on when sessions should be acquired/released? Is this > only for when using MemorySegment? In security area, the bytes are passed to > the JNI code which calls the native library to process the bytes and I wonder > if sessions should be acquired/released for these. Never mind, I see that there are already acquireSession/releaseSession calls when the ByteBuffer objects are accessed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25324#discussion_r2103213937