mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 09:32:40 +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());
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user