20 internal int Id => GetHashCode();
22 internal Bucket(
int bufferLength,
int numberOfBuffers,
int poolId)
34 bool lockTaken =
false;
71 bool lockTaken =
false;
102 private int Id => GetHashCode();
111 if (maxArrayLength <= 0)
115 if (maxArraysPerBucket <= 0)
119 if (maxArrayLength > 1073741824)
121 maxArrayLength = 1073741824;
123 else if (maxArrayLength < 16)
130 for (
int i = 0; i <
array.Length; i++)
137 public override T[]
Rent(
int minimumLength)
139 if (minimumLength < 0)
143 if (minimumLength == 0)
145 return Array.Empty<T>();
165 while (++num2 <
_buckets.Length && num2 != num + 2);
170 array =
new T[minimumLength];
174 int hashCode =
array.GetHashCode();
187 if (
array.Length == 0)
204 int hashCode =
array.GetHashCode();
static unsafe void Clear(Array array)
unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
unsafe void BufferDropped(int bufferId, int bufferSize, int poolId, int bucketId, BufferDroppedReason reason)
void BufferReturned(int bufferId, int bufferSize, int poolId)
static readonly ArrayPoolEventSource Log
unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
readonly int _bufferLength
Bucket(int bufferLength, int numberOfBuffers, int poolId)
readonly Bucket[] _buckets
ConfigurableArrayPool(int maxArrayLength, int maxArraysPerBucket)
override void Return(T[] array, bool clearArray=false)
override T[] Rent(int minimumLength)
static int GetMaxSizeForBucket(int binIndex)
static int SelectBucketIndex(int bufferSize)
static string ArgumentException_BufferNotFromPool
void Enter(ref bool lockTaken)