Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Return()

override void System.Buffers.ConfigurableArrayPool< T >.Return ( T[] array,
bool clearArray = false )
inline

Definition at line 181 of file ConfigurableArrayPool.cs.

182 {
183 if (array == null)
184 {
185 throw new ArgumentNullException("array");
186 }
187 if (array.Length == 0)
188 {
189 return;
190 }
191 int num = Utilities.SelectBucketIndex(array.Length);
192 bool flag = num < _buckets.Length;
193 if (flag)
194 {
195 if (clearArray)
196 {
197 Array.Clear(array);
198 }
199 _buckets[num].Return(array);
200 }
201 ArrayPoolEventSource log = ArrayPoolEventSource.Log;
202 if (log.IsEnabled())
203 {
204 int hashCode = array.GetHashCode();
205 log.BufferReturned(hashCode, array.Length, Id);
206 if (!flag)
207 {
208 log.BufferDropped(hashCode, array.Length, Id, -1, ArrayPoolEventSource.BufferDroppedReason.Full);
209 }
210 }
211 }

References System.Buffers.ConfigurableArrayPool< T >._buckets, System.array, System.Buffers.ArrayPoolEventSource.BufferDropped(), System.Buffers.ArrayPoolEventSource.BufferReturned(), System.Array.Clear(), System.Buffers.ConfigurableArrayPool< T >.Id, System.Diagnostics.Tracing.EventSource.IsEnabled(), System.Buffers.ArrayPoolEventSource.Log, System.Buffers.ConfigurableArrayPool< T >.Bucket.Return(), and System.Buffers.Utilities.SelectBucketIndex().