typedarraypool,"\ntypedarraypool( [dtype] )\n Returns an uninitialized typed array from a typed array memory pool.\n\n Memory is **uninitialized**, which means that the contents of a returned\n typed array may contain sensitive contents.\n\n The function supports the following data types:\n\n - float64: double-precision floating-point numbers (IEEE 754)\n - float32: single-precision floating-point numbers (IEEE 754)\n - complex128: double-precision complex floating-point numbers\n - complex64: single-precision complex floating-point numbers\n - int32: 32-bit two's complement signed integers\n - uint32: 32-bit unsigned integers\n - int16: 16-bit two's complement signed integers\n - uint16: 16-bit unsigned integers\n - int8: 8-bit two's complement signed integers\n - uint8: 8-bit unsigned integers\n - uint8c: 8-bit unsigned integers clamped to 0-255\n\n The default typed array data type is `float64`.\n\n Parameters\n ----------\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool()\n <Float64Array>[]\n > arr = typedarraypool( 'float32' )\n <Float32Array>[]\n\n\ntypedarraypool( length[, dtype] )\n Returns an uninitialized typed array having a specified length from a typed\n array memory pool.\n\n Parameters\n ----------\n length: integer\n Typed array length.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool( 5 )\n <Float64Array>\n > arr = typedarraypool( 5, 'int32' )\n <Int32Array>\n\n\ntypedarraypool( typedarray[, dtype] )\n Creates a pooled typed array from another typed array.\n\n Parameters\n ----------\n typedarray: TypedArray\n Typed array from which to generate another typed array.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr1 = typedarraypool( [ 0.5, 0.5, 0.5 ] );\n > var arr2 = typedarraypool( arr1, 'float32' )\n <Float32Array>[ 0.5, 0.5, 0.5 ]\n\n\ntypedarraypool( obj[, dtype] )\n Creates a pooled typed array from an array-like object.\n\n Parameters\n ----------\n obj: Object\n Array-like object from which to generate a typed array.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr1 = [ 0.5, 0.5, 0.5 ];\n > var arr2 = typedarraypool( arr1, 'float32' )\n <Float32Array>[ 0.5, 0.5, 0.5 ]\n\n\ntypedarraypool.malloc( [dtype] )\n Returns an uninitialized typed array from a typed array memory pool.\n\n This method shares the same security vulnerabilities mentioned above.\n\n Parameters\n ----------\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool.malloc()\n <Float64Array>\n > arr = typedarraypool.malloc( 'float32' )\n <Float32Array>\n\n\ntypedarraypool.malloc( length[, dtype] )\n Returns a typed array having a specified length from a typed array memory\n pool.\n\n Parameters\n ----------\n length: integer\n Typed array length.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool.malloc( 5 )\n <Float64Array>\n > arr = typedarraypool.malloc( 5, 'int32' )\n <Int32Array>\n\n\ntypedarraypool.malloc( typedarray[, dtype] )\n Creates a pooled typed array from another typed array.\n\n Parameters\n ----------\n typedarray: TypedArray\n Typed array from which to generate another typed array.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr1 = typedarraypool.malloc( [ 0.5, 0.5, 0.5 ] );\n > var arr2 = typedarraypool.malloc( arr1, 'float32' )\n <Float32Array>[ 0.5, 0.5, 0.5 ]\n\n\ntypedarraypool.malloc( obj[, dtype] )\n Creates a pooled typed array from an array-like object.\n\n Parameters\n ----------\n obj: Object\n Array-like object from which to generate a typed array.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr1 = [ 0.5, 0.5, 0.5 ];\n > var arr2 = typedarraypool.malloc( arr1, 'float32' )\n <Float32Array>[ 0.5, 0.5, 0.5 ]\n\n\ntypedarraypool.calloc( [dtype] )\n Returns a zero-initialized typed array from a typed array memory pool.\n\n Parameters\n ----------\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool.calloc()\n <Float64Array>[]\n > arr = typedarraypool.calloc( 'float32' )\n <Float32Array>[]\n\n\ntypedarraypool.calloc( length[, dtype] )\n Returns a zero-initialized typed array having a specified length from a\n typed array memory pool.\n\n Parameters\n ----------\n length: integer\n Typed array length.\n\n dtype: string (optional)\n Data type. Default: 'float64'.\n\n Returns\n -------\n out: TypedArray|null\n If the function is unable to allocate a typed array from the typed array\n pool (e.g., due to insufficient memory), the function returns `null`.\n\n Examples\n --------\n > var arr = typedarraypool.calloc( 5 )\n <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0 ]\n > arr = typedarraypool.calloc( 5, 'int32' )\n <Int32Array>[ 0, 0, 0, 0, 0 ]\n\n\ntypedarraypool.free( buf )\n Frees a typed array or typed array buffer for use in a future allocation.\n\n Parameters\n ----------\n buf: TypedArray|ArrayBuffer\n Typed array or typed array buffer to free.\n\n Examples\n --------\n > var arr = typedarraypool( 5 )\n <Float64Array>\n > typedarraypool.free( arr )\n\n\ntypedarraypool.clear()\n Clears the typed array pool allowing garbage collection of previously\n allocated (and currently free) array buffers.\n\n Examples\n --------\n > var arr = typedarraypool( 5 )\n <Float64Array>\n > typedarraypool.free( arr );\n > typedarraypool.clear()\n\n\ntypedarraypool.highWaterMark\n Read-only property returning the pool's high water mark.\n\n Once a high water mark is reached, typed array allocation fails.\n\n Examples\n --------\n > typedarraypool.highWaterMark\n\n\ntypedarraypool.nbytes\n Read-only property returning the total number of allocated bytes.\n\n The returned value is the total accumulated value. Hence, anytime a pool\n must allocate a new array buffer (i.e., more memory), the pool increments\n this value.\n\n The only time this value is decremented is when a pool is cleared.\n\n This behavior means that, while allocated buffers which are never freed may,\n in fact, be garbage collected, they continue to count against the high water\n mark limit.\n\n Accordingly, you should *always* free allocated buffers in order to prevent\n the pool from believing that non-freed buffers are continually in use.\n\n Examples\n --------\n > var arr = typedarraypool( 5 )\n <Float64Array>\n > typedarraypool.nbytes\n\n\ntypedarraypool.factory( [options] )\n Creates a typed array pool.\n\n Parameters\n ----------\n options: Object (optional)\n Function options.\n\n options.highWaterMark: integer (optional)\n Maximum total memory (in bytes) which can be allocated.\n\n Returns\n -------\n fcn: Function\n Function for creating typed arrays from a typed array memory pool.\n\n Examples\n --------\n > var pool = typedarraypool.factory();\n > var arr1 = pool( 3, 'float64' )\n <Float64Array>\n\n See Also\n --------\n typedarray\n"
0 commit comments