Reputation: 1408
Can someone please explain how to fix this memory leak in nodejs:
var foo = function (data, cb) {
cb(data);
};
setInterval(function() {
foo('asdf', function(data) {
console.log(data);
});
}, 500);
Upvotes: 1
Views: 2047
Reputation: 1355
Actually I agree with @vkurchatkin, there is no memory leak. I tried to run this code with small variations and my results: node
processes had no memory incrementation. But my terminal emulator rxvt
does. You should check yours.
Usefull topic: How to prevent memory leaks in node.js?
Upvotes: 3