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

ByteArrayOutputStream capacity should be maximal array size permitted by VM

XMLWordPrintable

    • b29
    • generic
    • generic
    • Verified

        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/

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

                Created:
                Updated:
                Resolved: