RFR: 8371718: (sc) Channels.new{Input, Output}Stream can allocate unbounded memory for a socket channel [v3]

Alan Bateman alanb at openjdk.org
Tue Dec 9 08:22:01 UTC 2025


On Mon, 8 Dec 2025 21:41:38 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Clamp read and write to 128k bytes.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8371718: Move limit retrieval outside loop

src/java.base/share/classes/sun/nio/ch/Streams.java line 38:

> 36:     // The maximum number of bytes to read/write per syscall to avoid needing
> 37:     // a huge buffer from the temporary buffer cache
> 38:     static final int MAX_BUFFER_SIZE = 128 * 1024;

It would be okay for NioSocketImpl to use this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28705#discussion_r2601561998


More information about the nio-dev mailing list