Skip to content

Determines the initial memory usage of any javascript variable in NODE.JS

License

Notifications You must be signed in to change notification settings

CLDMV/sizeofvar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sizeofvar

Description

sizeofvar allows you to get a realistic memory size of any variable upon initialization or variable setting.

Install

npm i @cldmv/sizeofvar --save

Usage

const sizeofvar = require('@cldmv/sizeofvar');
console.log(sizeofvar(variable));

Test Examples

The included tests allow you to verify that the number returned from this module represents the memory usage reported by node for a variable.

node -expose-gc test/test-mem.js command [-v]

-expose-gc

This option is required to run the memory tests. Without it you will recieve an error.

test/test-mem.js

This is the test file. It handles a command to test various variable tests.

command

Valid values are:

  • array
  • bool
  • number
  • object
  • object-complex
  • object-key-length
  • object-string
  • string

❤️ Contributors

This project exists thanks to all the people who contribute. [Contributors].

About

Determines the initial memory usage of any javascript variable in NODE.JS

Resources

License

Stars

Watchers

Forks

Packages

No packages published