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

Use delete to avoid memory leak #122

Merged
merged 1 commit into from
Oct 25, 2021
Merged

Use delete to avoid memory leak #122

merged 1 commit into from
Oct 25, 2021

Conversation

jayantk
Copy link

@jayantk jayantk commented Oct 25, 2021

Hey there! I'm using your library via a somewhat involved chain of dependencies, and I've been running into a memory leak. I debugged it using the node's heap inspector and I found that the queue object here continuously grows in size because its keys never get deleted. The object looks like {1: null, 2: null, 3: null, ...}.

The fix is pretty easy -- just use delete to remove the key from the object in addition to the value.

The main change is the delete thing ^. Some other files seem to have changed when I made the change above and ran test and I'm not sure why. I'm kind of a noob to the js ecosystem, so please tell me if I should revert some of those changes.

@mkozjak
Copy link
Member

mkozjak commented Oct 25, 2021

@jayantk you did everything right! Thanks so much!

@mkozjak mkozjak merged commit d5c34c7 into elpheria:trunk Oct 25, 2021
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