npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

memtrack

v0.1.12

Published

Plot memory usage of a Node.js program over time. Highlight memory leaks and leaking objects.

Downloads

4

Readme

memtrack

memtrack is a node module for plotting memory usage over time for a Node.js program. It also highlights memory leaks and indicates the type of objects that are contributing to memory growth.

This module uses memwatch module and process.memoryUsage() function to pull out useful stats.

THE MODULE IS EXPERIMENTAL, AND WILL GO THROUGH MORE TESTING AND NECESSARY ENHANCEMENTS.

Installation

npm install memtrack

Usage

The following call should be placed before any other require statement in your application, e.g. at the first line of your main module

require('memtrack')();

memtrack will be started as a web server on port 7575, you can access it by pointing your browser to: http://[yourhost]:7575.

You will see a log message on the console like :

memtrack started on 0.0.0.0:7575

You will find a graph plotting the heap memory usage over time and a bar chart showing objects contributing to memory growth.

To obtain additional debug messages at runtime, run your node js program as follows :

DEBUG=* node mynodeprogram

Options

  • port Listening port, defaulting to 7575
  • host Listening host, defaulting to 0.0.0.0
  • memInterval Time interval in milliseconds for invoking process.memoryUsage() defaulting to 2*60*1000, that is 2 minutes. Actually, if you set memInterval below 2 minutes, it is reset to 2 minutes (in order to limit the frequency of calling process.memUsage() ).
require('memtrack')({port:7373, memInterval:180000});

Additional Features

You will receive an alert on the memtrack webpage, if the heap memory used exceeds 50% of your RAM.

At least three hours of memory stats are saved in memory while your Node program is running. So, if you start your Node.js program and then connect to memtrack from a browser much later, you still get graphical view of the most recent memory usage stats.

Testing

An example program has been taken from the memwatch source. The relevant file is:

tests/leaky.js

To see how memtrack works, run the command:

node tests/leaky.js

and point your browser to

http://localhost:7575

(Allow for a delay of about 5 minutes for any useful data to show up.)

Screenshots

You can find some screenshots of this tool here:

http://techyugadi.net/nodejs/2015/03/19/memtrack/