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

Bug-fix/fixes memory leaks in priority queue #62

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

nikhilk1701
Copy link
Contributor

@nikhilk1701 nikhilk1701 commented Dec 6, 2021

The Pop() in the implementation of the priorityQueue is re-slicing the items array. This lead to the slice being shrunk down but the reference to the item is still maintained by the underlying array. Because of this, the golang GC assumes that the item was still accessible and thus didn’t deallocate it. This is resulting in memory leaks when the application is run for very long sessions. More information can be found on this SO entry.

@ReneKroon
Copy link
Contributor

Agreed that this is always a problem since a pointer is stored in the array.

@ReneKroon ReneKroon merged commit e2f836b into jellydator:master Dec 6, 2021
@ReneKroon
Copy link
Contributor

it's released, thanks for the contribution!

@nikhilk1701
Copy link
Contributor Author

nikhilk1701 commented Dec 7, 2021

Happy to contribute and thanks for the quick response. :)

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.

None yet

2 participants