Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2124

ByteArrayDataOutputStream: expand more conservatively

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Minor
    • 4.0
    • None

    Description

      Currently, unless exponential growth is enabled, BADOSs expand as follows:
      new_length = remaining_length + new bytes required + 32

      If we have a 1024 buffer with pos=4 and want to add 1024 bytes, then we expand the buffer to 1020 + 1024 + 32 = 2076 bytes which is wasted space.

      I'm changing this to
      new_length = pos + new bytes required + 32. In the above example, we'd expand the buffer to 1060 bytes.

      If we really wanted bigger expansion, exponential growth should be enabled.

      Attachments

        Activity

          People

            rhn-engineering-bban Bela Ban
            rhn-engineering-bban Bela Ban
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: