NodeJS : How to debug “EventEmitter memory leak detected. 11 listeners added”

前端 未结 8 500
攒了一身酷
攒了一身酷 2020-11-28 20:23

How can I debug my application which throw this error:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxList         


        
相关标签:
8条回答
  • 2020-11-28 21:09

    This warning will be thrown if you register for a particular event of a same object more than 11 times.

    Check if you are having 'on' call for particualr event in a function which you are calling frequently, this leads to registering for an event multiple times.

    This link helped me to understand this.

    0 讨论(0)
  • 2020-11-28 21:13

    Since node 6 you should use node --trace-warnings: https://nodejs.org/api/cli.html#cli_trace_warnings

    0 讨论(0)
提交回复
热议问题