Skip to content

Uses console.log to dump current memory usage if it grows or decreased by about 25%. Runs global.gc() when a large memory increase is detected.

License

Notifications You must be signed in to change notification settings

oxygen/node-log-memory-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-log-memory-usage

Library which uses console.log() to dump current memory usage if it grows or decreases by about 25%.

Runs global.gc() when a large memory increase is detected.

Calls process.exit(1) when memory usage exceeds the set threshold.

Usage

npm i node-log-memory-usage

const LogMemoryUsage = require("log-memory-usage");

setInterval(
	() => {
		LogMemoryUsage.check();
	},

	30 * 1000
);

You need to start the node process using --expose-gc to enable this library to call global.gc() when memory increases are detected.

That's it.

About

Uses console.log to dump current memory usage if it grows or decreased by about 25%. Runs global.gc() when a large memory increase is detected.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published