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

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. #132

Open
quantang opened this issue Dec 23, 2020 · 0 comments
Open

Comments

@quantang
Copy link
Contributor

Hello @sekur,

I got the following warning when I try to use yang.js to "eval" the JSON data repeatedly.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 change listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit

I can understand that we attached some events with the schema, such as "change", on the Model level. So I tried to release the model by call "delete" function, but it looks like the events didn't get removed from the schema.

Maybe the way that I use "eval" is inappropriate, but I guess the events should be got "off" when the model is deleted.

Here is my code:
const model = YangSchema.schema.eval(_.cloneDeep(defaultData)); const result = doSomethingWithModel(model); model.delete();

Any suggestion or feedback is welcome.
Cheers.

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

No branches or pull requests

1 participant