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

tests: hashmap optimize memory usage #1780

Open
wants to merge 1 commit into
base: stage
Choose a base branch
from

Conversation

iurii-ssv
Copy link

@iurii-ssv iurii-ssv commented Oct 8, 2024

I've noticed that test(s) in github.com/ssvlabs/ssv/utils/hashmap package consume up to 8GB of memory when running, sometimes it even results in the test being killed by OS:

ok  	github.com/ssvlabs/ssv/utils/format	1.012s	coverage: 70.8% of statements
PASS
coverage: 100.0% of statements
signal: killed
FAIL	github.com/ssvlabs/ssv/utils/hashmap	9.973s
ok  	github.com/ssvlabs/ssv/utils/rsaencryption	1.895s	coverage: 56.8% of statements

There seems to be a memory leak (creating Timer objects in almost infinite loop that is forcefully broken by Test terminating its run). This PR fixes it, and cleans up a bit.

I've also checked all other places in this repo that could have had similar issues (when combining for{}, select, time.After) and found only 1 other test affected by this: #1781

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

Successfully merging this pull request may close these issues.

2 participants