size the allocation to the required bytes

This commit is contained in:
pjulien 2016-04-18 21:43:28 -04:00
parent b0146b3d9a
commit 9fb87f813b
1 changed files with 1 additions and 1 deletions

View File

@ -95,7 +95,7 @@ public class Table {
int required = (int)((float)length * decoder.maxCharsPerByte()); int required = (int)((float)length * decoder.maxCharsPerByte());
CharBuffer dst = CHAR_BUFFER.get(); CharBuffer dst = CHAR_BUFFER.get();
if (dst == null || dst.capacity() < required) { if (dst == null || dst.capacity() < required) {
dst = CharBuffer.allocate(Math.max(required, 128)); dst = CharBuffer.allocate(required);
CHAR_BUFFER.set(dst); CHAR_BUFFER.set(dst);
} }