mempool.js
JavaScript true memory pooling solution.
mempool.js is powerful solution to reusable memory managment in your JavaScript application.
Installation
$ npm install mempool.js
Build and Test Scripts
$ cd build$ node build.js all$ cd ../test$ node test.js
API Usage Examples
Load module:
var mempool = MemoryPool = mempoolMemoryPool TypedMemoryPool = mempoolTypedMemoryPool;
MemoryPool:
// custom class.{ thisvalue = value;} PooledObjectprototypevalue = null; // create memory pool.PooledObjectpool = PooledObjectprototype // memory pool wil store custom class objects. 1 // pool capacity.; // create instance from pool.var instance = PooledObjectpool; // MemoryPool::factory() gets instance from pool and calls it's constructor.PooledObjectpool; // this will print error because you are trying to get instance from empty pool. // release instance to pool.PooledObjectpool; // destroyPooledObjectpool;
TypedMemoryPool:
pool = Int32Array 1 3;var instance = pool;instance1 = 2;pool;pool;