RFR: 8316660: (fs) Files.lines implementation can use MemorSegment for file mapping [v7]

Alan Bateman alanb at openjdk.org
Sun Sep 24 14:44:10 UTC 2023


On Thu, 21 Sep 2023 16:24:22 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes using a `MemorySegment` instead of a `ByteBuffer` in the `Files::lines` implementation (in the internal class `FileChannelLinesSpliterator`).
>> 
>> The old solution deterministically unmapped the `ByteBuffer` if closed. If not closed, the `ByteBuffer` would be GC:ed.
>> 
>> This proposal mimics the old behavior but may hold the mapped memory region slightly longer.
>> 
>> Tested and passed tier1, tier2, tier3
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reformat

There is significant refactoring here that will take time to review, one thing that will need to be examined is the use of a shared Arena as I think the close op becomes O(N) on the number of platform threads.

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

PR Comment: https://git.openjdk.org/jdk/pull/15814#issuecomment-1732588021


More information about the nio-dev mailing list