-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove all event listeners on close to avoid memory leak #808
Conversation
I'm not too sure about this change. The problem is that we'll end up removing ALL listeners; even those that might've been setup outside of the Inquirer code base. I'd prefer to specifically remove the listeners we're adding. |
It only removes listeners for a single event emitter. If we create the emitter we should be safe to remove listeners for it (which we do in |
Yeah for sure won't be easy... Let's try this out, and if no one raises issues, we should be good to go. |
#811 |
In light of #811 I looked into this, and from what I can tell,
@SBoudrias in retrospect, perhaps a bit more scrutiny should be put on changes like this considering this package has 12mil+ weekly downloads |
Summary
Fix for #805 by removing all event listeners on
prompt.ui.close()
.Testing
In the repro (https://github.com/jared-hexagon/inquirer-memory-leak-repro) I
npm link
ed my fork and theMaxListenersExceededWarning
warning never shows up.