0.1.1 • Published 7 years ago

memory-leak-heapdump v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

memory-leak-heapdump

License Build Status Coverage Status npm version
memory-leak-heapdump is based on memwatch-next and heapdump. It can dump heapsnapshot if memory leak.

Install

npm install memory-leak-heapdump --save

Usage

snapshot

  • js
var heapdump = require('memory-leak-heapdump').Heapdump;
heapdump.snapshot('/tmp/test.heapsnapshot')
    .then(function (filepath) {
        console.log('snapshot file path: ', filepath);
    })
    .catch(function (err) {
        console.error(err);
    });
  • ts
import { Heapdump } from "memory-leak-heapdump";
Heapdump.snapshot("/tmp/test.heapsnapshot")
    .then((filepath) => {
        console.log("snapshot file path: ", filepath);
    })
    .catch((err) => {
        console.error(err);
    });

Watch leak and snapshot

  • ts
import { Watcher, WatcherConfig } from "memory-leak-heapdump";
const watcherConfig = new WatcherConfig();
watcherConfig.appName = "targetAppName";
watcherConfig.snapshotDir = "/tmp";
watcherConfig.snapshotMinInterval = 18000; // 3 min interval(avoid cpu usage issue).

const handleSnapshot = (err: Error, filepath: string): void => {
    if (util.isNullOrUndefined(err)) {
        console.info("snapshot file path: ", filepath);
    } else {
        console.error("handleSnapshot: ", err);
    }
};
watcher.snapshotIfLeak(handleSnapshot);
0.1.1

7 years ago

0.1.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago