RFR: 8294696 - BufferedInputStream.transferTo should drain buffer when mark set [v2]
Alan Bateman
alanb at openjdk.org
Wed Oct 19 08:35:04 UTC 2022
On Mon, 3 Oct 2022 05:54:31 GMT, Markus KARG <duke at openjdk.org> wrote:
>> This PR implements JDK-8294696.
>
> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>
> Checking explicitly -1 instead of < 0
> * 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.
-------------
PR: https://git.openjdk.org/jdk/pull/10525
More information about the core-libs-dev
mailing list