Closed newmanw closed 5 years ago
Same problem here, got error:
(node:10058) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pin23 listeners added. Use emitter.setMaxListeners() to increase limit
Here is a little demonstration
var rpio = require('rpio')
rpio.init({ mapping: 'gpio' });
var pin = 23;
function foo () {
console.log('foo');
}
rpio.open(pin, rpio.INPUT);
rpio.poll(pin, foo, rpio.POLL_HIGH);
for (i = 0; i < 20; i++) {
rpio.poll(pin, null, rpio.POLL_HIGH);
rpio.poll(pin, foo, rpio.POLL_HIGH);
}
rpio.open(pin, rpio.OUTPUT);
rpio.write(pin, rpio.LOW)
The script generates following output:
$ sudo node test.js (node:12646) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pin23 listeners added. Use emitter.setMaxListeners() to increase limit foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
I switched from 0.9.16 to 0.9.19, on 0.9.16 the problem was not present afaik.
Commit 0e5886ad71d4cc58b935d86eedf62c2e4325cb4e introduced this problem.
Still facing this problem. Any news about this?
@DaVarga could you test #77? It works on my end.
@Wouter0100 also works great for me. Thanks for this fix :+1:
Would be awesome. I tested your sample code, which worked. @DaVarga
Would it be possible to prevent callbacks on a pin from being sent if poll is deregistered?