RFR: 8129776: The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed [v3]

Brian Burkhalter bpb at openjdk.java.net
Wed Jan 27 19:32:07 UTC 2021


> Please review this proposed change to unmap the mapped buffer shared between the root and sub-spliterators used in the optimized `Stream` implementation returned by `Files.lines()`. A reference counter is added to track the total number of spliterators sharing the buffer. It is set to 1 when the shared buffer is created, and incremented each time a sub-spliterator is created. It is decremented when traversing begins or when the spliterator is closed. If the counter is zero after it is decremented then the shared buffer is unmapped.

Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:

  8129776: Wire up MappedByteBuffer.unmapper().unmap()

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2229/files
  - new: https://git.openjdk.java.net/jdk/pull/2229/files/36c34a5d..e2b0219f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2229&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2229&range=01-02

  Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2229.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2229/head:pull/2229

PR: https://git.openjdk.java.net/jdk/pull/2229


More information about the nio-dev mailing list