From 85f64786daee767a9dd2b0bbf91e675d123b67b1 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 4 Feb 2015 15:30:47 -0800 Subject: [PATCH] Reset minimum alignment when reusing FlatBufferBuilder Previously, if you were re-using instances of FlatBufferBuilder and an earlier buffer would use a 64bit item where later ones do not, you could be wasting space. Change-Id: Ic8090a38f97ce73194e991ba72bcfae74a7ace9f Tested: on Linux. --- include/flatbuffers/flatbuffers.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index df7186327..a20b5bfb2 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -454,6 +454,7 @@ class FlatBufferBuilder FLATBUFFERS_FINAL_CLASS { buf_.clear(); offsetbuf_.clear(); vtables_.clear(); + minalign_ = 1; } // The current size of the serialized buffer, counting from the end.