Skip to content

Commit e9800f8

Browse files
committed
Include hash cash in DynamicUsage
Note that this was already included in `using CCoinsMap`: > Most implementations have an overhead of 1 or 2 pointers, so nodes can be connected in a linked list, and in some cases the hash value is stored as well.
1 parent 6df3234 commit e9800f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/memusage.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ static inline size_t DynamicUsage(const std::unordered_map<Key,
212212
size_t estimated_list_node_size = MallocUsage(sizeof(void*) * 3);
213213
size_t usage_resource = estimated_list_node_size * pool_resource->NumAllocatedChunks();
214214
size_t usage_chunks = MallocUsage(pool_resource->ChunkSizeBytes()) * pool_resource->NumAllocatedChunks();
215-
return usage_resource + usage_chunks + MallocUsage(sizeof(void*) * m.bucket_count());
215+
size_t usage_buckets = MallocUsage(sizeof(void*) * m.bucket_count());
216+
size_t usage_hash_cache_overhead = m.size() * sizeof(size_t);
217+
218+
return usage_resource + usage_chunks + usage_buckets + usage_hash_cache_overhead;
216219
}
217220

218221
} // namespace memusage

0 commit comments

Comments
 (0)