You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

memory-stats

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memory-stats

Minimal monitor for JS Heap Size via performance.memory

1.0.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

memory-stats.js

Like stats.js but for JS memory

@jeromeetienne, inspired by mrdoob's stats.js code, wrote this as part of tquery. I've now promoted it to a standalone repo and cleaned it all up.

image

Usage:

  • 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 the stats.element to the DOM, and run stats.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);
    });

Run Chrome with the flag and open demo/index.html to see it in action.

Framework adaptors

Keywords

performance

FAQs

Package last updated on 17 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts