node-twitter icon indicating copy to clipboard operation
node-twitter copied to clipboard

memory leak

Open staminna opened this issue 8 years ago • 5 comments

Hi. I seem to have a memory leak in the stream function

(node) warning: possible EventEmitter memory leak detected. 11 data listeners added. Use emitter.setMaxListeners() to increase limit. -- Called from events.js:235:17(function EventEmitter.addListener)logMsg @ client.js:63(anonymous function) @ client.js:97c.emit @ socket.io.js:2c.onPacket @ socket.io.js:2d.onPacket @ socket.io.js:2c.onPacket @ socket.io.js:2c.onData @ socket.io.js:2websocket.onmessage @ socket.io.js:2 client.js:63 Trace at EventEmitter.addListener (events.js:239:17) at Namespace. (/Applications/MAMP/htdocs/wit.ai/project/tweetplugin.js:59:16) at emitOne (events.js:77:13) at Namespace.emit (events.js:169:7) at Namespace.emit (/Applications/MAMP/htdocs/wit.ai/project/node_modules/socket.io/lib/namespace.js:206:10) at /Applications/MAMP/htdocs/wit.ai/project/node_modules/socket.io/lib/namespace.js:174:14 at doNTCallback0 (node.js:407:9) at process._tickCallback (node.js:336:13) -- Called from console.js:80:8(function Console.trace)

tweetplugin.js:59:
'stream.on('data', function(tweet)'

What does this mean?

staminna avatar Mar 06 '16 16:03 staminna

Yeah my apps crashing and freezing up. Am using the stream function

thomaswelton avatar Mar 10 '16 12:03 thomaswelton

This is more likely that your need to unlisten from the stream. You can set the max amount of listeners with emitter.getMaxListeners() and emitter.setMaxListeners()

However I would suggest when your done with an event listener you remove it and init it again when needed.

wonderdogone avatar May 06 '16 20:05 wonderdogone

Can you give us some sample code in a gist or code block?

reconbot avatar May 14 '16 15:05 reconbot

I'm going to close this issue due to it's age, but if you'd like to continue with it feel free to reopen.

reconbot avatar May 14 '16 19:05 reconbot

:wave: I'm getting this issue as well. We could set emitter.setMaxListeners but I believe this is happening within the node module and not within our personally written code, right?

I am not using streams, fyi.

Thanks again :)

peterpme avatar Jun 12 '17 20:06 peterpme