RFR: 8284638: store skip buffers in InputStream Object [v2]

Roger Riggs rriggs at openjdk.java.net
Wed Apr 13 15:16:16 UTC 2022


On Wed, 13 Apr 2022 15:03:22 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> This change may be  problematic for servers with a large number connections and an input stream for each connection. It could add up to 2k to the footprint of each connection when skip is used.
>
>> @AlanBateman You are correct about this. But I wonder if this be a problem, why Reader class can afford store a skip buffer for each Reader.
>> 
>> Is there anything different in the situations about skipBuffer in Reader and InputStream?
> 
> Maybe the skip buffer in Reader should be looked at too, esp. as it couldpotentially grow to 16k bytes. The concern with changing InputStream.skip is that there may be a lot more input streams than readers in use, esp. if there is an input stream for every socket connection.

@AlanBateman Is the concern about holding more memory sufficient to retain the buffer using a SoftReference so it can be freed eagerly?
These buffers are never read from, so are quite a waste, but at least they are only used when
the underlying stream overrides skip.

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

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


More information about the core-libs-dev mailing list