RFR: 8316156: (ch) Channels.newOutputStream(ch).write(bigByteArray) allocates a lot of direct memory [v3]

Alan Bateman alanb at openjdk.org
Thu Sep 14 19:35:46 UTC 2023


On Thu, 14 Sep 2023 19:25:35 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> In `ChannelInputStream` and `ChannelOutputStream`, process small chunks of bytes in sequence to avoid running afoul of the `MaxDirectMemorySize`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8316156: Convert test to JUnit 5 and separate read/write testing

src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java line 84:

> 82:             rem -=n;
> 83:         }
> 84:         return nread;

This still looks like a "read fully", I don't think we should have a loop here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15733#discussion_r1326429863


More information about the nio-dev mailing list