Skip to content

Instantly share code, notes, and snippets.

@Matt-Esch
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Matt-Esch/21b2766fab8b30300c6e to your computer and use it in GitHub Desktop.
Save Matt-Esch/21b2766fab8b30300c6e to your computer and use it in GitHub Desktop.
Leaking memory due to timer unref
var setTimeout = require('timers').setTimeout;
var work = 0;
setTimeout(function loop() {
var timer = setTimeout(function () {
work += 1;
loop();
}, 0);
timer.unref();
}, 0);
(function keepalive() {
setTimeout(function () { keepalive(); }, 1000000000);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment