Created
May 6, 2013 22:04
-
-
Save danielepolencic/5528608 to your computer and use it in GitHub Desktop.
This file contains 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
// The following piece of code produce steady usage of memory | |
// when one of the first two console.log are uncommented. However, | |
// when the last console.log is the only console.log uncommented, | |
// memory usage grows indefinitely. | |
setInterval( function(){ | |
var util = require('util') | |
// Uncomment one of the following lines: | |
// console.log('Ding! ', 'Dong' ) // 16.9MB | |
// console.log('Ding! ', util.inspect('Dong') ) // 17.1MB | |
// console.log('Ding! ', util.inspect(process.memoryUsage()) ) // LEAK?! | |
var myarray = [] | |
for(var i=0;i<100;i+=1){ | |
myarray.push({}) | |
} | |
}, 10 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on 0.10.2 and 0.10.5
Also, sounds like I'm not alone http://stackoverflow.com/questions/15823874/setinterval-is-hogging-up-resources-alternatives-the-node-js-way