-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
memory leak, when module require error occurs #32836
Comments
lianxuify
changed the title
memory leak, when module dependency error occurs, this useless module is not deleted in parent module: parent.children
memory leak, when module require error occurs
Apr 14, 2020
4 tasks
lianxuify
added a commit
to lianxuify/node
that referenced
this issue
Apr 15, 2020
Delete useless module in parent module: parent.children array when error occuers so that the memory can be garbage collected. Fixes: nodejs#32836
targos
pushed a commit
to targos/node
that referenced
this issue
Apr 25, 2020
Delete useless module in parent module: parent.children array when error occurs, so that it can be garbage collected. Fixes: nodejs#32836 PR-URL: nodejs#32837 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
What steps will reproduce the bug?
What is the expected behavior?
Run main.js , expected error module completely clear and willl be garbage collected.
What do you see instead?
It is still retained by parent module now.
Additional information
I discovered this in the process of solving the my service memory leak problem, which logic like:each request load the module for some reason, unfortunately module is syntax error.
I checked the source code of nodejs and found that when the module error was occurs, the golbal module cache and the resolve path cache were deleted, but the module in parent.children array was not deleted.
I solved the problem, preparing my first PR for nodejs, and looking forward to your review.
The text was updated successfully, but these errors were encountered: