mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 03:41:36 +00:00
Use all of the available space in the buffer returned by ByteBufferFactory to allow the factory to keep a pool of larger than initialsize sized buffers. (#5500)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
8e6cabb31b
commit
cb35d3a0e5
@@ -72,7 +72,6 @@ public class FlatBufferBuilder {
|
|||||||
if (initial_size <= 0) {
|
if (initial_size <= 0) {
|
||||||
initial_size = 1;
|
initial_size = 1;
|
||||||
}
|
}
|
||||||
space = initial_size;
|
|
||||||
this.bb_factory = bb_factory;
|
this.bb_factory = bb_factory;
|
||||||
if (existing_bb != null) {
|
if (existing_bb != null) {
|
||||||
bb = existing_bb;
|
bb = existing_bb;
|
||||||
@@ -82,6 +81,7 @@ public class FlatBufferBuilder {
|
|||||||
bb = bb_factory.newByteBuffer(initial_size);
|
bb = bb_factory.newByteBuffer(initial_size);
|
||||||
}
|
}
|
||||||
this.utf8 = utf8;
|
this.utf8 = utf8;
|
||||||
|
space = bb.capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user