From 9fb87f813b77f4dbb96ae8fa9420f5f77b247489 Mon Sep 17 00:00:00 2001 From: pjulien Date: Mon, 18 Apr 2016 21:43:28 -0400 Subject: [PATCH] size the allocation to the required bytes --- java/com/google/flatbuffers/Table.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com/google/flatbuffers/Table.java b/java/com/google/flatbuffers/Table.java index f6ae4706b..408765420 100644 --- a/java/com/google/flatbuffers/Table.java +++ b/java/com/google/flatbuffers/Table.java @@ -95,7 +95,7 @@ public class Table { int required = (int)((float)length * decoder.maxCharsPerByte()); CharBuffer dst = CHAR_BUFFER.get(); if (dst == null || dst.capacity() < required) { - dst = CharBuffer.allocate(Math.max(required, 128)); + dst = CharBuffer.allocate(required); CHAR_BUFFER.set(dst); }