0
我使用一個樹莓PI約翰尼個節點模塊,驅動器上的機器人幾個舵機與下面的腳本樹莓PI節點EventEmitter內存泄露
var five = require('johnny-five'), board, servo, led;
board = new five.Board();
board.on('ready', function(){
servo = new five.Servo({pin: 9, range:[0,180]});
// Allow direct commandline access
board.repl.inject({s: servo});
});
我這運行時出現以下錯誤對樹莓PI代碼節點0.10.29-1
1(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at process.EventEmitter.addListener (events.js:160:15)
at process.on.process.addListener (node.js:768:26)
at Board.broadcast (/home/pi/sonny/node_modules/johnny-five/lib/board.js:375:15)
at Board.<anonymous> (/home/pi/sonny/node_modules/johnny-five/lib/board.js:154:18)
at SerialPort.<anonymous> (/home/pi/sonny/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:418:13)
at SerialPort.EventEmitter.emit (events.js:95:17)
at /home/pi/sonny/node_modules/johnny-five/node_modules/serialport/serialport.js:230:16
Need to setMaxListeners somewhere in the code.
但是如果我在我的筆記本上運行的代碼(Linux Mint的14 +節點0.10.20),它工作正常。
有沒有辦法在Raspberry PI(運行raspbian)上全局設置MaxListeners?
如果不是,我將如何添加setMaxListeners到我的代碼?