RFR(s): 8220394: bufferedStream does not honor size limit

Thomas Stüfe thomas.stuefe at gmail.com
Sun Mar 10 18:19:04 UTC 2019

Hi all,

may I have please reviews for this fix:

bug: https://bugs.openjdk.java.net/browse/JDK-8220394

When playing around with a new jcmd addition, I found that bufferedStream -
which is used quite a bit in the VM - in its dynamic, self-allocating form
does not honor the buffer size limit. So faulty or just plain verbose
printing code can cause high memory usage.

First I wanted to keep the change minimal but I found a number of things
wrong with bufferedStream, mainly the fact that "bufmax" was actually
used/misused as a flush threshold, for the use of the child class
"networkStream". So I decided to separate the two - buffer size max and
flush threshold - cleanly.

I also renamed the members to be conform with modern hotpsot code and
changed ctors to use initializer lists.

Note that when examining the streams, I found that they do not seem to
explicitly zero-terminate. I was surprised by that, is that intentional?

Cheers, Thomas

More information about the hotspot-runtime-dev mailing list