Skip to content

Instantly share code, notes, and snippets.

@zz85
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zz85/45e7998437281d74595a to your computer and use it in GitHub Desktop.
Save zz85/45e7998437281d74595a to your computer and use it in GitHub Desktop.
Print Memory
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