1.3.0 • Published 11 months ago

visible-memory-usage v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Visible Memory Usage v1.3.0 Documentation

Table of contents

Description

Node.js package for displaying memory usage as bars in the console. In order to make this library work, it is necessary to pass a Node.js cli argument --max-old-space-size. Example

Installation

npm i -D visible-memory-usage

Usage example

import { VisibleMemoryUsage } from 'visible-memory-usage'
const visibleMemoryUsage = new VisibleMemoryUsage()

visibleMemoryUsage.showMemoryUsage()
setTimeout(
  () => visibleMemoryUsage.hideMemoryUsage(),
  4e3 // Hide in 4 seconds
)

API

class VisibleMemoryUsage

  • constructor(fps: number = 60, memoryType: MemoryType = "rss")
    • fps (number): (Frames Per Second) is the frequency at which memory usage will be updated. Its value can be from 1 to 60. Lower the value, lower the CPU load will be. Default is 60.
    • memoryType (string): memory types are the keys of the Node.js process.memoryUsage() returned object and those are: 'rss' | 'heapTotal' | 'heapUsed' | 'external' | 'arrayBuffers'. Default value is 'rss'
  • showMemoryUsage(): method is used to display the memory.
  • hideMemoryUsage(): method is used to hide the memory.

Tip

Can be helpful when you are trying to find a memory leak.

1.3.0

11 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago