
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
typedarray-pool
Advanced tools
A global pool for typed arrays.
var pool = require("typedarray-pool")
//Allocate a buffer with at least 128 floats
var f = pool.malloc(128, "float")
// ... do stuff ...
//When done, release buffer
pool.free(f)
npm install typedarray-pool
var pool = require("typedarray-pool")
pool.malloc(n[, dtype])Allocates a typed array (or ArrayBuffer) with at least n elements.
n is the number of elements in the array
dtype is the data type of the array to allocate. Must be one of:
"uint8""uint16""uint32""int8""int16""int32""float""float32""double""float64""arraybuffer""data""uint8_clamped""bigint64""biguint64""buffer"Returns A typed array with at least n elements in it. If dtype is undefined, an ArrayBuffer is returned.
Note You can avoid the dispatch by directly calling one of the following methods:
pool.mallocUint8pool.mallocUint16pool.mallocUint32pool.mallocInt8pool.mallocInt16pool.mallocInt32pool.mallocFloatpool.mallocDoublepool.mallocArrayBufferpool.mallocDataViewpool.mallocUint8Clampedpool.mallocBigInt64pool.mallocBigUint64pool.mallocBufferpool.free(array)Returns the array back to the pool.
array The array object to return to the pool.Note You can speed up the method if you know the type of array before hand by calling one of the following:
pool.freeUint8pool.freeUint16pool.freeUint32pool.freeInt8pool.freeInt16pool.freeInt32pool.freeFloatpool.freeDoublepool.freeArrayBufferpool.freeDataViewpool.freeUint8Clampedpool.freeBigInt64pool.freeBigUint64pool.freeBufferpool.clearCache()Removes all references to cached arrays. Use this when you are done with the pool to return all the cached memory to the garbage collector.
(c) 2014 Mikola Lysenko. MIT License
The 'buffer-pool' package provides a similar functionality for managing and reusing Buffer objects. It helps in reducing memory fragmentation and garbage collection overhead by pooling Buffer instances. Unlike 'typedarray-pool', it is specifically designed for Node.js Buffer objects.
The 'array-pool' package offers a general-purpose pool for JavaScript arrays. It allows for efficient reuse of arrays to minimize garbage collection. While 'typedarray-pool' focuses on typed arrays, 'array-pool' is more generic and can be used for any type of JavaScript array.
The 'object-pool' package provides a pooling mechanism for JavaScript objects. It is useful for managing and reusing objects to reduce memory allocation overhead. Although it is not specific to typed arrays, it offers similar benefits in terms of memory management and performance optimization.
FAQs
Reuse typed arrays
We found that typedarray-pool 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.