Use all of the available space in the buffer returned by ByteBufferFactory to allow...
authorMorten Grouleff <mgr@humio.com>
Tue, 3 Sep 2019 18:13:32 +0000 (20:13 +0200)
committerWouter van Oortmerssen <aardappel@gmail.com>
Tue, 3 Sep 2019 18:13:32 +0000 (11:13 -0700)
java/com/google/flatbuffers/FlatBufferBuilder.java

index 4fe1c42..574516f 100644 (file)
@@ -72,7 +72,6 @@ public class FlatBufferBuilder {
         if (initial_size <= 0) {
           initial_size = 1;
         }
-        space = initial_size;
         this.bb_factory = bb_factory;
         if (existing_bb != null) {
           bb = existing_bb;
@@ -82,6 +81,7 @@ public class FlatBufferBuilder {
           bb = bb_factory.newByteBuffer(initial_size);
         }
         this.utf8 = utf8;
+        space = bb.capacity();
     }
 
    /**