JS内存监视器:memory-stats.js
jopen
10年前
一个极小的JS堆大小监视器,类似于stats.js但用于JS内存。
用法:
- Start Chrome with --enable-precise-memory-info
- Otherwise the results from performance.memory are bucketed and less useful.
- Include memory.stats.js
- Instantiate it (stats = new MemoryStats(), add thestats.elementto the DOM, and runstats.update()regularly.
That might look something like:
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); });