JS内存监视器:memory-stats.js

jopen 10年前

一个极小的JS堆大小监视器,类似于stats.js但用于JS内存。

用法:

  1. Start Chrome with --enable-precise-memory-info
    • Otherwise the results from performance.memory are bucketed and less useful.
  2. Include memory.stats.js
  3. 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);      });

项目主页:http://www.open-open.com/lib/view/home/1423926904092