Improve documentation for AlignedVectorAllocator
Change-Id: I08d8855458a854fd2ab13991da6a21a76cb21e24
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/flatbuffers/base.h b/aos/flatbuffers/base.h
index 045fce3..6e93f93 100644
--- a/aos/flatbuffers/base.h
+++ b/aos/flatbuffers/base.h
@@ -279,6 +279,8 @@
void Deallocate(std::span<uint8_t>) override;
+ // Releases the data which has been allocated from this allocator to the
+ // caller. This is needed because Deallocate actually frees the memory.
aos::SharedSpan Release();
private:
@@ -290,7 +292,12 @@
aos::AllocatorResizeableBuffer<aos::AlignedReallocator<kAlignment>> buffer_;
+ // The size of the data that has been returned from Allocate. This counts
+ // from the end of buffer_.
size_t allocated_size_ = 0u;
+ // If true, the data has been released from buffer_, and we don't own it
+ // anymore. This enables Deallocate to properly handle the case when the user
+ // releases the memory, but the Builder still needs to clean up.
bool released_ = false;
};