Created
April 6, 2016 20:40
-
-
Save PanMan/07192157a4edd68c98165686cd1d16e0 to your computer and use it in GitHub Desktop.
Take some memory and release it to test the GC
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
var testString="0123456789"; | |
setInterval(function (){ | |
console.log("Mem:", Math.round(process.memoryUsage().rss/1000000), " Mb ", process.memoryUsage(), "Len:",testString.length); | |
}, 1 * 1000); | |
for (i=0;i<20;i++){ | |
testString=testString+testString; //Double: 10 * 10 ^ | |
} | |
//Now testString=10.000.000 characters, which is roughly 20 Mb. | |
setTimeout(function(){ | |
testString=""; | |
//Now back to 0; | |
},2000) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment