Closed freak82 closed 5 years ago
Hello,
You're correct in your observations. The map behaves in the same way as std::unordered_map
and thus never shrinks except if rehash(0)
is explicitly called.
It would be possible for me to implement a min_load_factor
similar to google::sparse_hash_map
and spp::sparse_hash_map
if needed.
Thanks for the response. I'm closing the issue.
I'm using the sparse_map in scenario where the lower memory consumption is more important than the slightly increased CPU. My current usage is like this:
And then in the parent object constructor I set
This seems to be working fine when the sparse_map needs to grow.
However, I'm not sure how the sparse_map behaves when it shrinks and if it shrinks? Here are my observations from the source code of the sparse_map. Please, correct me if I'm wrong.
clear_deleted_buckets
upon insertion if them_load_threshold_clear_deleted
is reached. However,clear_deleted_buckets
callsrehash_impl
with the current buckets countm_bucket_count
. So, it seems to me that the bucket array also doesn't shrink back?