Close previous encoder before opening a new one
This reduces peak memory usage slightly. This is better than the
previous problem where we would keep *all* encoders open when rotating
the log file.
Change-Id: I24fec20e5293d4d0ea35e1e2cae97a170396afb0
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 990e742..27c6c3b 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -154,6 +154,7 @@
while (encoder_->queue_size() > 0) {
Flush(monotonic_clock::max_time);
}
+ encoder_.reset();
ran_out_of_space_ = file_handler_->Close() == WriteCode::kOutOfSpace;
}