Auto merge of #1058 - ebfull:coin-cache, r=ebfull

Flush to disk more consistently by accounting memory usage of serials/anchors in cache.

Closes #626.

It's important that this at least *approximates* the memory usage, so that we flush the cache to disk as expected. It's okay that we overestimate. The serials are stored in keys in the `boost::unordered_map`, so we can simply use that map's `DynamicMemoryUsage`. The anchors are another story.
This commit is contained in:
zkbot
2016-07-11 17:23:19 +00:00
3 changed files with 22 additions and 8 deletions

View File

@@ -60,6 +60,12 @@ public:
IncrementalMerkleTree() { }
size_t DynamicMemoryUsage() const {
return 32 + // left
32 + // right
parents.size() * 32; // parents
}
void append(Hash obj);
Hash root() const {
return root(Depth, std::deque<Hash>());