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

ByteArrayDataOutputStream: expand more conservatively

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Labels:

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                belaban Bela Ban
                Reporter:
                belaban Bela Ban
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: