GithubHelp home page GithubHelp logo

ageitgey / node-heapdump Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bnoordhuis/node-heapdump

1.0 3.0 0.0 91 KB

Make a dump of the V8 heap for later inspection.

License: ISC License

Python 5.98% C++ 81.48% JavaScript 12.55%

node-heapdump's Introduction

node-heapdump

Make a dump of the V8 heap for later inspection.

Install

npm install heapdump

Or, if you are running node.js v0.6 or v0.8:

npm install [email protected]

Build

node-gyp configure build

Usage

Load the add-on in your application:

var heapdump = require('heapdump');

The module exports a single writeSnapshot([filename]) function that writes out a snapshot. filename defaults to heapdump-<sec>.<usec>.heapsnapshot when omitted.

heapdump.writeSnapshot('/var/local/' + Date.now() + '.heapsnapshot');

On UNIX, it forks off a new process that writes out the snapshot in an asynchronous fashion. (That is, the function does not block.)

On Windows, however, it returns only after the snapshot is fully written. If the heap is large, that may take a while.

On UNIX platforms, you can force a snapshot by sending the node.js process a SIGUSR2 signal:

$ kill -USR2 <pid>

Inspecting the snapshot

Open Google Chrome and press F12 to open the developer toolbar.

Go to the Profiles tab, right-click in the tab pane and select Load profile....

Select the dump file and click Open. You can now inspect the heap snapshot at your leisure.

Note that Chrome will refuse to load the file unless it has the .heapsnapshot extension.

node-heapdump's People

Contributors

bnoordhuis avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.