Last active
August 29, 2015 14:05
-
-
Save zz85/45e7998437281d74595a to your computer and use it in GitHub Desktop.
Print Memory
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
function format_numbers(n) { | |
return (n / 1024 / 1024).toFixed(3) + 'MB'; | |
} | |
function mem() { | |
if (performance && performance.memory) { | |
console.log('used heap', format_numbers(performance.memory.usedJSHeapSize)) | |
console.log('total heap', format_numbers(performance.memory.totalJSHeapSize)) | |
console.log('heap limit', format_numbers(performance.memory.jsHeapSizeLimit)) | |
} | |
} | |
mem(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment