Created
October 24, 2012 18:06
-
-
Save 3rd-Eden/3947755 to your computer and use it in GitHub Desktop.
memleak?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// readStream that isn't piped in to anything | |
var s = require('fs').createReadStream('/dev/random'); | |
setTimeout(function kill(){ | |
s.destroy(); | |
console.log('stream killed'); | |
if ('gc' in global) { | |
global.gc(); | |
console.log('Garbage collected'); | |
} | |
}, 60 * 1000); | |
// just something silly to keep the event loop open. | |
setTimeout(function () { | |
console.log('k, tnx, ilu'); | |
}, (60 * 1000) * 60); | |
// Adding the following listener doesn't help either: | |
//s.on('data', function (buff) { | |
// console.log('buffer', buff.length); | |
//}); | |
// keep it running, after you get a stream killed message | |
// you will notice that the memory isn't dropping to like | |
// 30 mb ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment