RFR: 8294696 - BufferedInputStream.transferTo should drain buffer when mark set [v2]

Markus KARG duke at openjdk.org
Wed Oct 19 08:38:00 UTC 2022


On Wed, 19 Oct 2022 08:31:07 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> > * Alternative B: Instead of double-buffering I drop the original buffer and use a same-size replacement each time the buffer was drained inside of `transferTo`. This is a rather cheap solution and rather perfectly prevents OOME, as I drop _first_ before reallocating.
> 
> That is a good idea to try. It wouldn't work when BIS is extended but transferTo already checks this.

Correct, so I will give this one a try. Stay tuned. :-)

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

PR: https://git.openjdk.org/jdk/pull/10525


More information about the core-libs-dev mailing list