/// <summary> /// Supplies statistics on the usage of the cached array pools /// </summary> /// <returns></returns> public GenericArrayPoolStatistics[] Statistics() { lock (_poolCounts) { var result = new GenericArrayPoolStatistics[_poolCounts.Length]; Array.Copy(_poolCounts, result, _poolCounts.Length); return(result); } }
public GenericArrayPoolCaches() { _pools = new T[NumExponentialPoolsToProvide + 1][][]; _poolsLength = _pools.Length; // Establish rentable buffers per the default sizing for (var i = 0; i < _pools.Length; i++) { _pools[i] = new T[DEFAULT_POOL_CACHE_SIZES[i]][]; } for (var i = 0; i < _poolsLength; i++) { _poolCounts[i] = new GenericArrayPoolStatistics { PoolIndex = i, PoolCapacity = _pools[i].Length, AvailCount = 0 // Pools don't start pre-populated with objects }; } }