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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Jan 27 17:37:40 UTC 2021


On Wed, 27 Jan 2021 01:42:30 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> No, unmapping via `nioAccess.unmapper(b).unmap()` is not wired up. Investigating why.

MappedByteBuffer::unmapper is only used (AFAIK) from AbstractMemorySegmentImpl::ofBuffer. When creating a segment view over a buffer, we need to recover mapping info - but close() on the returned segment is a no-op. So we don't _need_ the unmap() method to be wired up - although it doesn't hurt for it to be wired up, if desired.

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

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


More information about the nio-dev mailing list