mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
size the allocation to the required bytes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user