Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8055949

ByteArrayOutputStream capacity should be maximal array size permitted by VM

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b29
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        It should be possible to write (almost) Integer.MAX_VALUE bytes to a ByteArrayOutputStream. In fact, because of resizing algorithm, the effective capacity is only half that.

        ByteArrayOutputStream should use the same resizing computation for huge capacities as is already done in collection classes like ArrayList.

        Fix is easy.

        http://cr.openjdk.java.net/~martin/webrevs/openjdk9/ByteArrayOutputStream-MAX_ARRAY_SIZE/

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                martin Martin Buchholz
                Reporter:
                martin Martin Buchholz
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: