dthree / dthree/vorpal

Memory leak on vorpal_ui_keypress listener

Open
#230 3 comments 6 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.6k
Forks
278
PR merge metrics
No merged PRs in 30d

Description

Creating a Vorpal instance attaches a callback to the event "vorpal_ui_keypress".

So running code like this will give you a warning.
```
const Vorpal = require("Vorpal");
var vorpalInst;

for (var i = 0; i < 12; i++ ) {
vorpalInst = new Vorpal();
}
```

This is the warning I get back.

> (node:1776) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 vorpal_ui_keypress listeners added. Use emitter.setMaxListeners() to increase limit
>

Shouldn't the event listener be added when you call the show method?
Also, shouldn't the old vorpal instance's event listener be removed when you call the show method for a new vorpal instance?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.