Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including enmap-memory with all npm packages installed. Try it out:

var enmapMemory = require("enmap-memory")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

enmap-memory v0.0.4

A Simple Enmap Memory Database

Enmap Memory Usage Database

This Is A Simple Memory Usage Enmap Database To See How Your Database Is Preforming Memory Usage Wise

Getting It Installed

npm install enmap-memory

Getting Your Workspace Ready

While Getting Your Memory Usage Database Ready You Want To Call The Following In The Beginning Of Your Code

const Discord = require("discord.js")
const Enmap = require("enmap")
const EnmapLevel = require("enmap-level")
const client = new Discord.Client()

Calling The Enmap Database

In Order To Receive Any Accurate Memory Usage Total From Your Database You Want To Call The Following Anywhere In Your Code

const level = new EnmapLevel({ name: 'DatabaseName' });
const myColl = new Enmap({ provider: level });

Getting Your Memory Usage Total

Under You Called The Database You Want To Include This Code So It'll Measure Your Memory Usage When You First Start The Database

const MemoryUsage = [`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}`]

return console.log(`${MemoryUsage}`);

Forcing An Exit On High Memory

Since Version 0.0.1 Of Enmap-Memory Will Have Some Slight Issues, We Allow It To Force An Exit When It Get's Too High If Not Bad Things Will Come About So Insert The Following Anywhere

// If Memory Get's Too High Than Normal Memory Usage Limit It'll Automataclly Exit The Process Of Working
client.on("debug", () => {
return console.log(`Memory Was Too High So Forcing An Exit - Current Memory Usage: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}`);
 process.exit(1)
});

Other Information

When Starting The Project, It'll Only Record The Current Memory Usage When Starting If You Want To Monitor It Fully Simply Install PM2 Then Run Command npm i pm2

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free