RFR: 8316660: Use a MemorSegment for file mapping in FileChannelLinesSpliterator

Alan Bateman alanb at openjdk.org
Thu Sep 21 10:53:41 UTC 2023


On Tue, 19 Sep 2023 08:52:29 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes using a `MemorySegment` instead of a `ByteBuffer` in `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

test/jdk/java/nio/file/FileChannelLinesSpliterator/Parallel.java line 45:

> 43: import static org.junit.jupiter.api.Assertions.*;
> 44: 
> 45: public class Parallel {

This test should needs to move to test/jdk/java/nio/file/Files and be named something like LinesParallel. The description can also say that it's a test for Files.lines.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15814#discussion_r1332866695


More information about the nio-dev mailing list