Socket
Book a DemoInstallSign in
Socket

memory-usage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memory-usage

A readable stream that samples and emits memory usage over time

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
81
-3.57%
Maintainers
1
Weekly downloads
 
Created
Source

memory-usage

A readable stream that samples and emits memory usage over time.

You can for instance use the output to graph your memory usage.

Build status js-standard-style

Installation

npm install memory-usage --save

Usage Example

Sample memory usage every 2 seconds and write it to a CSV file:

var fs = require('fs')
var csvWriter = require('csv-write-stream')
var memoryUsage = require('memory-usage')

memoryUsage(2000)
  .pipe(csvWriter())
  .pipe(fs.createWriteStream('memory.csv'))

Note that you application of course have to do some actual work. If you just run the example above as is, the node process will simply exit after creating an empty file.

API

stream = memoryUsage([freq])

Will start sampling memory usage every freq milliseconds (defaults to 5000) as soon as the stream is flowing.

The stream emits JavaScript objects of the following type:

{
  rss: 4935680,
  heapTotal: 1826816,
  heapUsed: 650472
}

See process.memoryUsage() for details of the format.

License

MIT

Keywords

mem

FAQs

Package last updated on 12 Nov 2016

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