]
Bela Ban updated JGRP-2124:
---------------------------
Labels: Beta3 (was: )
ByteArrayDataOutputStream: expand more conservatively
-----------------------------------------------------
Key: JGRP-2124
URL:
https://issues.jboss.org/browse/JGRP-2124
Project: JGroups
Issue Type: Enhancement
Reporter: Bela Ban
Assignee: Bela Ban
Priority: Minor
Labels: Beta3
Fix For: 4.0
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.