X Tutup
The Wayback Machine - https://web.archive.org/web/20220426094221/https://github.com/nodejs/node/pull/42680
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

lib: unlink the next pointer for FixedQueue to avoid potential memory leaks #42680

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

Conversation

Copy link
Contributor

@twchn twchn commented Apr 10, 2022

In the internal FixedQueue, once a FixedCircularBuffer is used out, it does not unlink the next pointer, thus if a variable references the head or tail field of FixedQueue, it will cause a memory leak. I wrote a reproducing example here. Another way is to make head and tail field private, but we need to modify the test cases in test/parallel/test-fixed-queue.js.

@nodejs-github-bot nodejs-github-bot added the needs-ci label Apr 10, 2022
@mscdex
Copy link
Contributor

@mscdex mscdex commented Apr 10, 2022

I'm not sure this is an existing problem since this is only used internally, unless you are saying definitively that there is an existing memory leak in node core?

@twchn
Copy link
Contributor Author

@twchn twchn commented Apr 10, 2022

I'm not sure this is an existing problem since this is only used internally

Yeah, that's what I mean 'potential' in the title.

unless you are saying definitively that there is an existing memory leak in node core?

Currently I only found this in test cases.

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

Successfully merging this pull request may close these issues.

None yet

3 participants
X Tutup