Struct ArrayPool<T>
An object pool for arrays with power-of-two lengths.
Namespace: GDX.Collections.Pooling
Syntax
public struct ArrayPool<T>
Type Parameters
Name | Description |
---|---|
T | The data type contained by pooled arrays. |
Constructors
| Improve this Doc View SourceArrayPool(Int32[], Int32[])
Initialize the array pool with initial and maximum sizes for each power-of-two, 0 through 30 inclusive (the maximum power-of-two length supported in C#).
Declaration
public ArrayPool(int[] initialPoolCounts, int[] maxPoolCapacities)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | initialPoolCounts | |
System.Int32[] | maxPoolCapacities |
Fields
| Improve this Doc View SourceArrayPools
Declaration
public JaggedArrayWithCount<T>[] ArrayPools
Field Value
Type | Description |
---|---|
JaggedArrayWithCount<T>[] |
MaxPoolCapacities
Declaration
public int[] MaxPoolCapacities
Field Value
Type | Description |
---|---|
System.Int32[] |
Methods
| Improve this Doc View SourceGet(Int32)
Allocates an array from the pool. Finds an array of the smallest power-of-two length larger than or equal to the requested size.
Declaration
public T[] Get(int requestedSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | requestedSize | The desired array length. The returned array will be the smallest power-of-two larger than or equal to this size. |
Returns
Type | Description |
---|---|
T[] |
Return(T[])
Return a power-of-two sized array to the pool. Only pass power-of-two sized arrays to this function. Does not clear the array.
Declaration
public void Return(T[] array)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The power-of-two sized array to return to the pool. Power-of-two sizes only. |