Question: Does swissmap shrink on key deletion?
Opened this issue · 1 comments
Jakobovski commented
Does swissmap suffer from the same key-deletion issue as golang map? Namely memory is not freed upon deleting of keys?
See golang/go#20135
sirmo commented
I modified the example from this article: https://100go.co/28-maps-memory-leaks/
Go's Map:
After creating map: 0 MB
After adding 1 million elements: 461 MB
After deleting 1 million elements: 293 MB
Swiss:
After creating map: 0 MB
After adding 1 million elements: 411 MB
After deleting 1 million elements: 274 MB
https://gist.github.com/sirmo/8b96e706c470d9d87a40317eff49ba9c
Although in my quest for a memory efficient Map, I did find HaxMap
After creating map: 0 MB
After adding 1 million elements: 184 MB
After deleting 1 million elements: 16 MB