[jboss-jira] [JBoss JIRA] (JGRP-2124) ByteArrayDataOutputStream: expand more conservatively
Bela Ban (JIRA)
issues at jboss.org
Fri Nov 4 07:19:00 EDT 2016
Bela Ban created JGRP-2124:
------------------------------
Summary: 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
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.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list