Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Possible EventEmitter memory leak #3

Open
mikermcneil opened this issue Mar 23, 2013 · 5 comments
Open

Possible EventEmitter memory leak #3

mikermcneil opened this issue Mar 23, 2013 · 5 comments

Comments

@mikermcneil
Copy link

Anyone else seen this?

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at EventEmitter.addListener (events.js:160:15)
    at /code/sails/node_modules/fs-watch-tree/lib/tree-watcher.js:74:21
    at /code/sails/node_modules/fs-watch-tree/lib/async.js:15:21
    at /code/sails/node_modules/fs-watch-tree/lib/fs-filtered.js:23:9
    at Object.oncomplete (fs.js:93:15)
@magnars
Copy link
Member

magnars commented Mar 23, 2013

I hadn't seen that before, but it's not a memory leak. There's just lots of watching going on. I guess the solution is just to up the limit.

@mikermcneil
Copy link
Author

@magnars Thanks for the feedback! If you know it offhand, would you mind throwing me a bone as far as the syntax to do this?

@magnars
Copy link
Member

magnars commented Apr 2, 2013

I don't know exactly how it works, but according to the error message, you can use emitter.setMaxListeners() to increase the limit.

@mikermcneil
Copy link
Author

Found some more info here: http://stackoverflow.com/questions/12151737/node-js-how-to-emitter-setmaxlisteners

More info:
It seems to only be happening on node v0.10.x.
Also, setting process.setMaxListeners(0) doesn't make a difference

Obviously, it's just a warning, so not a huge deal, but we're using this in https://github.com/balderdashy/sails, so I'm trying to kill the warning to avoid scaring new users.

@magnars
Copy link
Member

magnars commented Apr 2, 2013

I would wager a guess that you need to set max listeners directly on the complaining EventEmitter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants