SetInterval is hogging up resources- alternatives the Node.js way -
below simple function reports time system resources 100 times second:
var util = require('util'); function report(){ console.log(new date()); console.log(util.inspect(process.memoryusage())); } setinterval(report,10);
sure, example isn't practical- more illustrative purposes
it works- memory allocation goes up , , up. understanding, isn't memory leak- rather natural behavior of javascript. due function, or record of performed functions being added heap every time setinterval called. , long process alive.
so here's question:
is there better way achieve same output, more efficiently?
Comments
Post a Comment