I need to proof the concepts that it's possible to create a memory leak with EventEmmiters in node.js. I tried to google, but all of the examples are about frontend stuff(e.g.: Backbone views) or about polluting the global scope.
Asked
Active
Viewed 34 times
0
-
1Hi, I've found a thread here in SO which might help you: https://stackoverflow.com/questions/9768444/possible-eventemitter-memory-leak-detected – t3__rry Aug 07 '18 at 08:26
1 Answers
0
Create an eventListener each time some client is accessing a resource for example. After 10 eventListener you'll have some node warnings.With 50-100 event listeners it should be bad enough. Then start to emit events it will probably not go well.

François Richard
- 6,817
- 10
- 43
- 78
-
https://gist.github.com/kharandziuk/35e95981585fd2a494476a1e04a9d86b – can you check the example? it doesn't provide any, BTW – kharandziuk Aug 08 '18 at 16:29
-
I would put the emitter instanciation outside the route function – François Richard Aug 08 '18 at 16:59
-
https://gist.github.com/kharandziuk/ac2d05b945fc8061430203766c381480 – but still, memory usage doesn't grow – kharandziuk Aug 09 '18 at 09:42