Skip to content

Instantly share code, notes, and snippets.

@danielepolencic
Created May 6, 2013 22:04
Show Gist options
  • Save danielepolencic/5528608 to your computer and use it in GitHub Desktop.
Save danielepolencic/5528608 to your computer and use it in GitHub Desktop.
// 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 )
@danielepolencic
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment