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

Vyom Tewari vtewari at openjdk.org
Fri Sep 15 10:40:40 UTC 2023


On Thu, 14 Sep 2023 22:51:10 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: Read at most DEFAULT_BUFFER_SIZE bytes

test/jdk/java/nio/channels/Channels/ChannelStreamsIO.java line 80:

> 78:             byte[] dst = new byte[SIZE];
> 79:             int n = -1;
> 80:             if ((n = in.read(dst)) != SIZE)

in.read(dst) may return less then the requested(SIZE in this test) ?. Can you please add little bit more descriptive 'RuntimeException' message . It will help to debug issue faster if it fails in future.

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

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


More information about the nio-dev mailing list