Last active
August 29, 2015 14:14
-
-
Save jvandyke/e83ccdc4387a7ddc771f to your computer and use it in GitHub Desktop.
Show continuous memory profile for JavaScript application
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
Copied from https://github.com/paulirish/memory-stats.js | |
## memory-stats.js | |
Like [stats.js](https://github.com/mrdoob/stats.js/) but for JS memory | |
[@jeromeetienne](https://github.com/jeromeetienne/), inspired by mrdoob's stats.js code, wrote this as part of [tquery](https://github.com/jeromeetienne/tquery). I've now promoted it to a standalone repo and cleaned it all up. | |
 | |
### Usage: | |
1. Start Chrome with `--enable-precise-memory-info` | |
- Otherwise the results from performance.memory are bucketed and less useful. | |
1. Include memory.stats.js | |
1. Instatiate it (`stats = new MemoryStats()`, add the `stats.element` to the DOM, and run `stats.update()` regularly. | |
That might look something like index.html. |
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
<script src="https://cdn.rawgit.com/paulirish/memory-stats.js/master/memory-stats.js"></script> | |
<script> | |
var stats = new MemoryStats(); | |
stats.domElement.style.position = 'fixed'; | |
stats.domElement.style.right = '0px'; | |
stats.domElement.style.bottom = '0px'; | |
document.body.appendChild( stats.domElement ); | |
requestAnimationFrame(function rAFloop(){ | |
stats.update(); | |
requestAnimationFrame(rAFloop); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment