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

Per Minborg pminborg at openjdk.org
Thu Sep 21 13:45:49 UTC 2023


> 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:

  Add a reachability fence

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15814/files
  - new: https://git.openjdk.org/jdk/pull/15814/files/2cbdf366..8b64e5a7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15814&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15814&range=02-03

  Stats: 62 lines in 1 file changed: 22 ins; 16 del; 24 mod
  Patch: https://git.openjdk.org/jdk/pull/15814.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15814/head:pull/15814

PR: https://git.openjdk.org/jdk/pull/15814


More information about the nio-dev mailing list