Encode flatbuffers directly into the encoder when logging

We were running out of memory when running for many hours.  Initial
debugging looked like it was a heap fragmentation issue.  Tracking the
allocated memory using the malloc hooks wasn't showing any growth of
memory.  The heap was growing though.

Instead of allocating a FlatBufferBuilder/DetachedBuffer for each
message to be logged, we can instead have the BufferEncoder provide
memory to write to, and have it only alloate that buffer space once, and
allocate it to the maximum size that a writer might see.

Change-Id: I046bd2422aea368867b0c63cee7d04c6033fe724
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/flatbuffer_merge.h b/aos/flatbuffer_merge.h
index 61dbf6b..4d2d395 100644
--- a/aos/flatbuffer_merge.h
+++ b/aos/flatbuffer_merge.h
@@ -12,7 +12,7 @@
 // Merges 2 flat buffers with the provided type table into the builder.  Returns
 // the offset to the flatbuffers.
 // One or both of t1 and t2 must be non-null.  If one is null, this method
-// coppies instead of merging.
+// copies instead of merging.
 flatbuffers::Offset<flatbuffers::Table> MergeFlatBuffers(
     const flatbuffers::TypeTable *typetable, const flatbuffers::Table *t1,
     const flatbuffers::Table *t2, flatbuffers::FlatBufferBuilder *fbb);