Skip to content

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. #132

Description

@quantang

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions