Interface MemPoolOpts

interface MemPoolOpts {
    align: Pow2;
    buf: ArrayBufferLike;
    compact: boolean;
    end: number;
    minSplit: number;
    size: number;
    skipInitialization: boolean;
    split: boolean;
    start: number;
}

Properties

align: Pow2

Number of bytes to align memory blocks to. MUST be a power of 2 and >= 8. Use 16 if the pool is being used for allocating memory used in SIMD operations.

Default Value

8
buf: ArrayBufferLike

Backing ArrayBuffer (or SharedArrayBuffer). If not given, a new one will be created with given size.

compact: boolean

Flag to configure memory block compaction. If true, adjoining free blocks (in terms of address space) will be merged to minimize fragementation.

Default Value

true
end: number

Byte address (+1) of the end of the memory region managed by the MemPool.

Default Value

end of the backing ArrayBuffer
minSplit: number

Only used if split behavior is enabled. Defines min number of excess bytes available in a block for memory block splitting to occur.

Default Value

16, MUST be > 8
size: number

Byte size for newly created ArrayBuffers (if buf is not given).

Default Value

0x1000 (4KB)
skipInitialization: boolean

Only needed when sharing the underlying ArrayBuffer. If true, the MemPool constructor will NOT initialize its internal state and assume the underlying ArrayBuffer has already been initialized by another MemPool instance. If this option is used, buf MUST be given.

Default Value

false
split: boolean

Flag to configure memory block splitting. If true, and when the allocator is re-using a previously freed block larger than the requested size, the block will be split to minimize wasted/unused memory. The splitting behavior can further customized via the minSplit option.

Default Value

true
start: number

Anchor index (byte address) inside the array buffer. The MemPool stores its internal state from the given address and heap space starts at least 32 bytes later (depending on chosen align value). Unlike allocator state variables, `start`` cannot be saved inside the array buffer itself. If the ArrayBuffer is passed to other consumers they must use the same start value. MUST be multiple of 4.

Default Value

0

Generated using TypeDoc