Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
A resizable array using non-sequential block memory allocation. Growing or shrinking the array does not require reallocation of the entire array. Useful when you need to track a few trillion data points.
Note: For best results a 64-bit system and enough RAM to hold your data is recommended. If your data set grows slowly over time, paging to virtual memory may be acceptable.
npm install big-array
Usage: bigArray.Char(numberOfInitialElements, sizeOfElementBlocks)
var bigArray = require('big-array'),
ba, val;
// Numeric array types
ba = new bigArray.Char(10, 100);
ba = new bigArray.UnsignedChar();
ba = new bigArray.Int();
ba = new bigArray.UnsignedInt();
ba = new bigArray.ShortInt();
ba = new bigArray.ShortUnsignedInt();
ba = new bigArray.LongInt();
ba = new bigArray.LongUnsignedInt();
ba = new bigArray.Float();
ba = new bigArray.Double();
var bigArray = require('big-array'),
trillion = 1000 * 1000 * 1000 * 1000,
ba, i;
ba = bigArray.UnsignedChar();
// Unlike JavaScript, setting or getting a high index will result in
// the array allocating all elements before that index
ba.set(trillion, 5);
Tip: When testing on Linux, use "ulimit -v" to limit the maximum memory consumption.
# Limit memory usage to 10GB
ulimit -v 10485760
Common methods
set(index, value)
get(index)
// inc/dec by 1
inc(index)
dec(index)
push(value)
pop()
// modify push/pop index
setIndex(index)
getIndex()
// resize array to [size]
resize(size)
FAQs
When you need an array with a few trillion elements
We found that big-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.