1

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);
Steve P
  • 162
  • 1
  • 11
Keloo
  • 1,368
  • 1
  • 17
  • 36

1 Answers1

3

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?

Community
  • 1
  • 1
zarkone
  • 1,335
  • 10
  • 16