Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Does swissmap shrink on key deletion? #37

Open
Jakobovski opened this issue Oct 22, 2024 · 1 comment
Open

Question: Does swissmap shrink on key deletion? #37

Jakobovski opened this issue Oct 22, 2024 · 1 comment

Comments

@Jakobovski
Copy link

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

@Jakobovski Jakobovski changed the title Question: Does swissmap suffer shrink on key deletion? Question: Does swissmap shrink on key deletion? Oct 22, 2024
@sirmo
Copy link

sirmo commented Dec 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants