RFR: 8316156: (ch) Channels.newOutputStream(ch).write(bigByteArray) allocates a lot of direct memory
David Schlosnagle
duke at openjdk.org
Thu Sep 14 03:24:46 UTC 2023
On Thu, 14 Sep 2023 03:05:50 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`.
src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java line 49:
> 47: */
> 48: class ChannelInputStream extends InputStream {
> 49: static final int DEFAULT_BUFFER_SIZE = 8192;
Since this buffer size is now being used in more places, is it worth testing with 16KiB to match `InputStream` from https://github.com/openjdk/jdk/pull/11783?
Suggestion:
static final int DEFAULT_BUFFER_SIZE = 16384;
https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/src/java.base/share/classes/java/io/InputStream.java#L56
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15733#discussion_r1325307780
More information about the nio-dev
mailing list