On Tue, 20 May 2025 11:01:46 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Fix copyright year
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25324#discussion_r2100870190

Reply via email to