1152 references to Shared
Microsoft.AspNetCore.Components (5)
NavigationManager.cs (2)
367var locationChangingHandlersCopy = ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Rent(handlerCount); 413ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Return(locationChangingHandlersCopy);
Routing\RouteContext.cs (2)
61_pooled = ArrayPool<byte>.Shared.Rent(length); 71ArrayPool<byte>.Shared.Return(_pooled);
src\Components\Shared\src\ArrayBuilder.cs (1)
47_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
Microsoft.AspNetCore.Components.Endpoints (12)
FormMapping\Converters\CollectionAdapters\ArrayPoolBufferAdapter.cs (4)
12public static PooledBuffer CreateBuffer() => new() { Data = ArrayPool<TElement>.Shared.Rent(16), Count = 0 }; 18var newBuffer = ArrayPool<TElement>.Shared.Rent(buffer.Data.Length * 2); 20ArrayPool<TElement>.Shared.Return(buffer.Data); 31ArrayPool<TElement>.Shared.Return(buffer.Data);
FormMapping\HttpContextFormValueMapper.cs (2)
130buffer = ArrayPool<char>.Shared.Rent(options.MaxKeyBufferSize); 152ArrayPool<char>.Shared.Return(buffer);
FormMapping\PrefixResolver.cs (2)
17_sortedKeys = ArrayPool<FormKey>.Shared.Rent(count); 41ArrayPool<FormKey>.Shared.Return(_sortedKeys);
RazorComponentEndpointInvoker.cs (2)
83await using var writer = new HttpResponseStreamWriter(context.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared);
Results\RazorComponentResultExecutor.cs (2)
64await using var writer = new HttpResponseStreamWriter(httpContext.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared);
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Binding\FormDataMapperTests.cs (2)
2371var result = ArrayPool<int>.Shared.Rent(size); 2379ArrayPool<int>.Shared.Return(array);
Microsoft.AspNetCore.Components.Forms (1)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (1)
13private static readonly ArrayPool<char> s_arrayPool = ArrayPool<char>.Shared;
Microsoft.AspNetCore.Components.Server (17)
Circuits\ServerComponentDeserializer.cs (2)
306: (seenComponentIdsStorage = ArrayPool<int>.Shared.Rent(operations.Length)).AsSpan(0, operations.Length); 353ArrayPool<int>.Shared.Return(seenComponentIdsStorage);
ComponentHub.cs (2)
282var buffer = ArrayPool<byte>.Shared.Rent(32 * 1024); 294ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
src\Components\Shared\src\ArrayBuilder.cs (1)
47_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 27_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 95ArrayPool<T>.Shared.Return(_rentedBuffer); 163_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 171ArrayPool<T>.Shared.Return(oldBuffer);
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (2)
1102char[] charArray = ArrayPool<char>.Shared.Rent(maxCharLength); 1128ArrayPool<char>.Shared.Return(charArray);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (2)
1302var buffer = ArrayPool<byte>.Shared.Rent((int)sourceBytesToCopy); 1313ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Components.Web (1)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (1)
13private static readonly ArrayPool<char> s_arrayPool = ArrayPool<char>.Shared;
Microsoft.AspNetCore.Components.WebAssembly (2)
src\Components\Shared\src\TransmitDataStreamToJS.cs (2)
17var buffer = ArrayPool<byte>.Shared.Rent(32 * 1024); 46ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
Microsoft.AspNetCore.Components.WebView (3)
src\Components\Shared\src\ArrayBuilder.cs (1)
47_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\Components\Shared\src\TransmitDataStreamToJS.cs (2)
17var buffer = ArrayPool<byte>.Shared.Rent(32 * 1024); 46ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
Microsoft.AspNetCore.DataProtection.Abstractions (2)
src\Shared\WebEncoders\WebEncoders.cs (2)
329: bufferToReturnToPool = ArrayPool<char>.Shared.Rent(bufferSize); 336ArrayPool<char>.Shared.Return(bufferToReturnToPool);
Microsoft.AspNetCore.Http (2)
src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Http.Abstractions (3)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
Microsoft.AspNetCore.Http.Connections (5)
src\Shared\WebEncoders\WebEncoders.cs (2)
329: bufferToReturnToPool = ArrayPool<char>.Shared.Rent(bufferSize); 336ArrayPool<char>.Shared.Return(bufferToReturnToPool);
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.Http.Extensions (18)
RequestDelegateFactory.cs (3)
127private static readonly MethodInfo ArrayPoolSharedReturnMethod = typeof(ArrayPool<char>).GetMethod(nameof(ArrayPool<char>.Shared.Return))!; 2132Expression.Property(null, typeof(ArrayPool<char>).GetProperty(nameof(ArrayPool<char>.Shared))!), 2199buffer = ArrayPool<char>.Shared.Rent(maxKeyBufferSize);
src\Components\Endpoints\src\FormMapping\Converters\CollectionAdapters\ArrayPoolBufferAdapter.cs (4)
12public static PooledBuffer CreateBuffer() => new() { Data = ArrayPool<TElement>.Shared.Rent(16), Count = 0 }; 18var newBuffer = ArrayPool<TElement>.Shared.Rent(buffer.Data.Length * 2); 20ArrayPool<TElement>.Shared.Return(buffer.Data); 31ArrayPool<TElement>.Shared.Return(buffer.Data);
src\Components\Endpoints\src\FormMapping\PrefixResolver.cs (2)
17_sortedKeys = ArrayPool<FormKey>.Shared.Rent(count); 41ArrayPool<FormKey>.Shared.Return(_sortedKeys);
src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (4)
27_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2)); 301ArrayPool<char>.Shared.Return(toReturn); 312ArrayPool<char>.Shared.Return(toReturn);
Microsoft.AspNetCore.Http.Results (2)
src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.HttpLogging (9)
BufferingStream.cs (1)
169newSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(GetSegmentSize(sizeHint)));
src\Shared\Buffers\BufferSegment.cs (1)
73ArrayPool<byte>.Shared.Return(poolArray);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (4)
27_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2)); 301ArrayPool<char>.Shared.Return(toReturn); 312ArrayPool<char>.Shared.Return(toReturn);
Microsoft.AspNetCore.Mvc.Core (2)
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (2)
232services.TryAddSingleton(ArrayPool<byte>.Shared); 233services.TryAddSingleton(ArrayPool<char>.Shared);
Microsoft.AspNetCore.Mvc.Core.Test (3)
ContentResultTest.cs (1)
269new MemoryPoolHttpResponseStreamWriterFactory(ArrayPool<byte>.Shared, charArrayPool.Object)));
ModelBinding\Binders\BodyModelBinderTests.cs (2)
772: base(GetLogger(), new JsonSerializerSettings(), ArrayPool<char>.Shared, new DefaultObjectPoolProvider(), new MvcOptions(), new MvcNewtonsoftJsonOptions() 842: base(GetLogger(), new JsonSerializerSettings(), ArrayPool<char>.Shared, new DefaultObjectPoolProvider(), new MvcOptions(), new MvcNewtonsoftJsonOptions()
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
TestMvcOptions.cs (1)
39var charPool = ArrayPool<char>.Shared;
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (26)
JsonResultTest.cs (1)
49ArrayPool<char>.Shared);
NewtonsoftJsonHelperTest.cs (2)
26ArrayPool<char>.Shared); 93ArrayPool<char>.Shared);
NewtonsoftJsonInputFormatterTest.cs (12)
32ArrayPool<char>.Shared, 68ArrayPool<char>.Shared, 104ArrayPool<char>.Shared, 317ArrayPool<char>.Shared, 352ArrayPool<char>.Shared, 383ArrayPool<char>.Shared, 414ArrayPool<char>.Shared, 443ArrayPool<char>.Shared, 491ArrayPool<char>.Shared, 539ArrayPool<char>.Shared, 566: base(GetLogger(), settings, ArrayPool<char>.Shared, objectPoolProvider, new MvcOptions(), new MvcNewtonsoftJsonOptions()) 588ArrayPool<char>.Shared,
NewtonsoftJsonOutputFormatterTest.cs (7)
22return new NewtonsoftJsonOutputFormatter(new JsonSerializerSettings(), ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions()); 76var jsonFormatter = new NewtonsoftJsonOutputFormatter(settings, ArrayPool<char>.Shared, new MvcOptions()); 106var jsonFormatter = new NewtonsoftJsonOutputFormatter(settings, ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions() 133var jsonFormatter = new NewtonsoftJsonOutputFormatter(settings, ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions()); 351var formatter = new NewtonsoftJsonOutputFormatter(new JsonSerializerSettings(), ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions()); 382var formatter = new NewtonsoftJsonOutputFormatter(new JsonSerializerSettings(), ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions()); 555: base(serializerSettings, ArrayPool<char>.Shared, new MvcOptions(), new MvcNewtonsoftJsonOptions())
NewtonsoftJsonPatchInputFormatterTest.cs (3)
30ArrayPool<char>.Shared, 67ArrayPool<char>.Shared, 232ArrayPool<char>.Shared,
NewtonsoftJsonResultExecutorTest.cs (1)
23ArrayPool<char>.Shared);
Microsoft.AspNetCore.Mvc.ViewFeatures (6)
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensions.cs (1)
208services.TryAddSingleton(ArrayPool<ViewBufferValue>.Shared);
src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 27_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 95ArrayPool<T>.Shared.Return(_rentedBuffer); 163_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 171ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.Mvc.Views.TestCommon (1)
TestViewBufferScope.cs (1)
28return new PagedBufferedTextWriter(ArrayPool<char>.Shared, writer);
Microsoft.AspNetCore.OpenApi (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.OutputCaching (8)
OutputCacheEntry.cs (2)
90var arr = ArrayPool<(string, StringValues)>.Shared.Rent(count); 100ArrayPool<(string, StringValues)>.Shared.Return(arr);
OutputCacheEntryFormatter.cs (3)
52ArrayPool<string>.Shared.Return(lease); 80lease = ArrayPool<string>.Shared.Rent(tags.Count); 267var headerArr = ArrayPool<(string Name, StringValues Values)>.Shared.Rent(headersCount);
RecyclableArrayBufferWriter.cs (3)
39ArrayPool<T>.Shared.Return(tmp); 119_buffer = ArrayPool<T>.Shared.Rent(newSize); 123ArrayPool<T>.Shared.Return(oldArray);
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (6)
EndToEndBenchmarks.cs (6)
41ArrayPool<byte>.Shared.Return(arr); 52_payloadOversized = ArrayPool<byte>.Shared.Rent(PayloadLength); 207var oversized = ArrayPool<byte>.Shared.Rent(PayloadLength); 214ArrayPool<byte>.Shared.Return(oversized); 273ArrayPool<byte>.Shared.Return(arr); 277public NullPipeWriter(int size) => _buffer = ArrayPool<byte>.Shared.Rent(size);
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (2)
RedisOutputCacheStore.cs (2)
257leased = ArrayPool<byte>.Shared.Rent(len); 266ArrayPool<byte>.Shared.Return(leased);
Microsoft.AspNetCore.OutputCaching.Tests (3)
OutputCacheEntryFormatterTests.cs (3)
183ArrayPool<byte>.Shared.Return(xBuffer); 187ArrayPool<byte>.Shared.Return(yBuffer); 199lease = ArrayPool<byte>.Shared.Rent(len);
Microsoft.AspNetCore.Owin (2)
WebSockets\OwinWebSocketAdapter.cs (2)
138var buffer = ArrayPool<byte>.Shared.Rent(_rentedBufferSize); 149ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Server.Kestrel.Core (14)
Internal\Http\Http1OutputProducer.cs (3)
412ArrayPool<byte>.Shared.Return(_fakeMemory); 673ArrayPool<byte>.Shared.Return(_fakeMemory); 692return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Http\HttpParser.cs (2)
416Span<byte> headerSpan = headerLength <= 256 ? stackalloc byte[256] : array = ArrayPool<byte>.Shared.Rent(headerLength); 443ArrayPool<byte>.Shared.Return(array);
Internal\Http2\Http2OutputProducer.cs (3)
236ArrayPool<byte>.Shared.Return(_fakeMemory); 661ArrayPool<byte>.Shared.Return(_fakeMemory); 680return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Http3\Http3OutputProducer.cs (3)
92ArrayPool<byte>.Shared.Return(_fakeMemory); 235ArrayPool<byte>.Shared.Return(_fakeMemory); 254return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (1)
358newSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(minSize));
src\Shared\Buffers\BufferSegment.cs (1)
73ArrayPool<byte>.Shared.Return(poolArray);
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (1)
128private static ArrayPool<byte> Pool => ArrayPool<byte>.Shared;
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (1)
128private static ArrayPool<byte> Pool => ArrayPool<byte>.Shared;
src\Shared\WebEncoders\WebEncoders.cs (2)
329: bufferToReturnToPool = ArrayPool<char>.Shared.Rent(bufferSize); 336ArrayPool<char>.Shared.Return(bufferToReturnToPool);
Microsoft.AspNetCore.SignalR.Client.Tests (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.SignalR.Common (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.SignalR.Common.Tests (2)
Internal\Protocol\MemoryBufferWriterTests.cs (2)
20var buffer = ArrayPool<byte>.Shared.Rent(1); 23ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.SignalR.Core (2)
Internal\Utf8HashLookup.cs (2)
84(pooled = ArrayPool<char>.Shared.Rent(count)); 89ArrayPool<char>.Shared.Return(pooled);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (4)
src\SignalR\common\Shared\JsonUtils.cs (1)
200internal static readonly JsonArrayPool<T> Shared = new JsonArrayPool<T>(ArrayPool<T>.Shared);
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.SignalR.Specification.Tests (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
src\SignalR\common\Shared\MemoryBufferWriter.cs (3)
95ArrayPool<byte>.Shared.Return(_currentSegment); 187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint)); 401ArrayPool<byte>.Shared.Return(Buffer);
Microsoft.AspNetCore.WebSockets (7)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (4)
27_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2)); 301ArrayPool<char>.Shared.Return(toReturn); 312ArrayPool<char>.Shared.Return(toReturn);
Microsoft.AspNetCore.WebUtilities (22)
BufferedReadStream.cs (1)
31: this(inner, bufferSize, ArrayPool<byte>.Shared)
FileBufferingReadStream.cs (2)
57: this(inner, memoryThreshold, bufferLimit, tempFileDirectoryAccessor, ArrayPool<byte>.Shared) 109: this(inner, memoryThreshold, bufferLimit, tempFileDirectory, ArrayPool<byte>.Shared)
FileBufferingWriteStream.cs (1)
55PagedByteBuffer = new PagedByteBuffer(ArrayPool<byte>.Shared);
FormPipeReader.cs (2)
360var byteArray = ArrayPool<byte>.Shared.Rent((int)ros.Length); 370ArrayPool<byte>.Shared.Return(byteArray);
FormReader.cs (3)
51: this(data, ArrayPool<char>.Shared) 74: this(stream, Encoding.UTF8, ArrayPool<char>.Shared) 84: this(stream, encoding, ArrayPool<char>.Shared)
HttpRequestStreamReader.cs (4)
42: this(stream, encoding, DefaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared) 53: this(stream, encoding, bufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared)
HttpResponseStreamWriter.cs (4)
38: this(stream, encoding, DefaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared) 49: this(stream, encoding, bufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared)
MultipartReaderStream.cs (1)
26: this(stream, boundary, ArrayPool<byte>.Shared)
src\Shared\WebEncoders\WebEncoders.cs (2)
329: bufferToReturnToPool = ArrayPool<char>.Shared.Rent(bufferSize); 336ArrayPool<char>.Shared.Return(bufferToReturnToPool);
StreamHelperExtensions.cs (2)
26return stream.DrainAsync(ArrayPool<byte>.Shared, null, cancellationToken); 41return stream.DrainAsync(ArrayPool<byte>.Shared, limit, cancellationToken);
Microsoft.AspNetCore.WebUtilities.Tests (42)
FileBufferingReadStreamTests.cs (4)
410.Returns((int m) => ArrayPool<byte>.Shared.Rent(m)); 412.Callback((byte[] bytes, bool clear) => ArrayPool<byte>.Shared.Return(bytes, clear)); 439.Returns((int m) => ArrayPool<byte>.Shared.Rent(m)); 441.Callback((byte[] bytes, bool clear) => ArrayPool<byte>.Shared.Return(bytes, clear));
HttpRequestStreamReaderTest.cs (14)
359var httpRequestStreamReader = new HttpRequestStreamReader(new MemoryStream(), Encoding.UTF8, size, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 370var httpRequestStreamReader = new HttpRequestStreamReader(mockStream.Object, Encoding.UTF8, 1, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 378var httpRequestStreamReader = new HttpRequestStreamReader(new MemoryStream(), Encoding.UTF8, 10, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 391var httpRequestStreamReader = new HttpRequestStreamReader(new MemoryStream(), Encoding.UTF8, 10, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 441yield return new object?[] { null, Encoding.UTF8, ArrayPool<byte>.Shared, ArrayPool<char>.Shared }; 442yield return new object?[] { new MemoryStream(), null, ArrayPool<byte>.Shared, ArrayPool<char>.Shared }; 443yield return new object?[] { new MemoryStream(), Encoding.UTF8, null, ArrayPool<char>.Shared }; 444yield return new object?[] { new MemoryStream(), Encoding.UTF8, ArrayPool<byte>.Shared, null };
HttpResponseStreamWriterTest.cs (16)
695ArrayPool<byte>.Shared, 696ArrayPool<char>.Shared)) 747var httpRequestStreamReader = new HttpRequestStreamReader(new MemoryStream(), Encoding.UTF8, size, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 758var httpRequestStreamReader = new HttpRequestStreamReader(mockStream.Object, Encoding.UTF8, 1, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 766var httpResponseStreamWriter = new HttpResponseStreamWriter(new MemoryStream(), Encoding.UTF8, 10, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 779var httpResponseStreamWriter = new HttpResponseStreamWriter(new MemoryStream(), Encoding.UTF8, 10, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 848yield return new object?[] { null, Encoding.UTF8, ArrayPool<byte>.Shared, ArrayPool<char>.Shared }; 849yield return new object?[] { new MemoryStream(), null, ArrayPool<byte>.Shared, ArrayPool<char>.Shared }; 850yield return new object?[] { new MemoryStream(), Encoding.UTF8, null, ArrayPool<char>.Shared }; 851yield return new object?[] { new MemoryStream(), Encoding.UTF8, ArrayPool<byte>.Shared, null };
PagedByteBufferTest.cs (8)
17using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 34using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 51using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 68using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 85using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 101using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 126using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared); 150using var buffer = new PagedByteBuffer(ArrayPool<byte>.Shared);
Microsoft.Build (6)
InterningBinaryReader.cs (2)
156resultBuffer ??= ArrayPool<char>.Shared.Rent(stringLength); // Actual string length in chars may be smaller. 182ArrayPool<char>.Shared.Return(resultBuffer);
Logging\BinaryLogger\Postprocessing\StreamExtensions.cs (2)
33byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 34using var _ = new CleanupScope(() => ArrayPool<byte>.Shared.Return(buffer));
Logging\OptimizedStringIndenter.cs (2)
107ArrayPool<StringSegment>.Shared.Return(pooledArray); 139pooledArray = ArrayPool<StringSegment>.Shared.Rent(segmentCount);
Microsoft.Build.Tasks.Core (6)
Hash.cs (4)
75shaBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(ShaBufferSize); 76itemSpecChunkByteBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(s_encoding.GetMaxByteCount(MaxInputChunkLength)); 110System.Buffers.ArrayPool<byte>.Shared.Return(shaBuffer); 114System.Buffers.ArrayPool<byte>.Shared.Return(itemSpecChunkByteBuffer);
InterningBinaryReader.cs (2)
156resultBuffer ??= ArrayPool<char>.Shared.Rent(stringLength); // Actual string length in chars may be smaller. 182ArrayPool<char>.Shared.Return(resultBuffer);
Microsoft.Extensions.Caching.Hybrid (4)
Internal\BufferChunk.cs (1)
66ArrayPool<byte>.Shared.Return(Array!);
Internal\RecyclableArrayBufferWriter.cs (3)
73ArrayPool<T>.Shared.Return(tmp); 188_buffer = ArrayPool<T>.Shared.Rent(newSize); 192ArrayPool<T>.Shared.Return(oldArray);
Microsoft.Extensions.Caching.MicroBenchmarks (3)
src\Caching\Hybrid\src\Internal\RecyclableArrayBufferWriter.cs (3)
73ArrayPool<T>.Shared.Return(tmp); 188_buffer = ArrayPool<T>.Shared.Rent(newSize); 192ArrayPool<T>.Shared.Return(oldArray);
Microsoft.Extensions.Caching.SqlServer (4)
DatabaseOperations.cs (2)
334lease ??= ArrayPool<byte>.Shared.Rent(DefaultPageSize); 355ArrayPool<byte>.Shared.Return(lease);
SqlServerCache.cs (2)
250lease = ArrayPool<byte>.Shared.Rent(length); 259ArrayPool<byte>.Shared.Return(lease);
Microsoft.Extensions.Caching.StackExchangeRedis (2)
RedisCache.cs (2)
139lease = ArrayPool<byte>.Shared.Rent(length); 148ArrayPool<byte>.Shared.Return(lease);
Microsoft.Extensions.DependencyModel (6)
DependencyContextJsonReader.cs (6)
35ArrayPool<byte>.Shared.Return(buffer.Array!); 67rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); 71rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); 103rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2)); 106ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); 121ArrayPool<byte>.Shared.Return(rented);
Microsoft.Extensions.Logging.Abstractions (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
Microsoft.Extensions.Logging.Console (6)
src\libraries\Common\src\System\Text\Json\PooledByteBufferWriter.cs (6)
40_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity); 93ArrayPool<byte>.Shared.Return(toReturn); 116ArrayPool<byte>.Shared.Return(toReturn); 124_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity); 206_rentedBuffer = ArrayPool<byte>.Shared.Rent(newSize); 214ArrayPool<byte>.Shared.Return(oldBuffer);
Microsoft.Extensions.Logging.Generators (3)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);
Microsoft.JSInterop (3)
Infrastructure\DotNetDispatcher.cs (2)
223var buffer = ArrayPool<byte>.Shared.Rent(count); 283ArrayPool<byte>.Shared.Return(buffer);
src\Components\Shared\src\ArrayBuilder.cs (1)
47_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
Microsoft.Net.Http.Headers (4)
ContentDispositionHeaderValue.cs (4)
552: bufferFromPool = ArrayPool<byte>.Shared.Rent(requiredLength); 567ArrayPool<byte>.Shared.Return(bufferFromPool); 720unescapedBytes = ArrayPool<byte>.Shared.Rent(dataString.Length); 756ArrayPool<byte>.Shared.Return(unescapedBytes);
MonoTargetsTasks (2)
ILStrip\ILStrip.cs (2)
344zeroBuffer = ArrayPool<byte>.Shared.Rent(methodSize); 347ArrayPool<byte>.Shared.Return(zeroBuffer);
MSBuild (2)
InterningBinaryReader.cs (2)
156resultBuffer ??= ArrayPool<char>.Shared.Rent(stringLength); // Actual string length in chars may be smaller. 182ArrayPool<char>.Shared.Return(resultBuffer);
PresentationCore (3)
System\Windows\Media\RenderData.cs (3)
474_buffer = ArrayPool<byte>.Shared.Rent(cbRequiredSize); 491byte[] newBuffer = ArrayPool<byte>.Shared.Rent(newSize); 504ArrayPool<byte>.Shared.Return(oldBuffer);
PresentationFramework (2)
System\Windows\Markup\Baml2006\Baml2006Reader.cs (2)
1117byte[] pooledArray = ArrayPool<byte>.Shared.Rent(toRead); 1123ArrayPool<byte>.Shared.Return(pooledArray);
System.Collections.Immutable (22)
System\Collections\Frozen\FrozenHashTable.cs (4)
59int[] arrayPoolBuckets = ArrayPool<int>.Shared.Rent(numBuckets + hashCodes.Length); 114ArrayPool<int>.Shared.Return(arrayPoolBuckets); 214int[] seenBuckets = ArrayPool<int>.Shared.Rent((maxNumBuckets / BitsPerInt32) + 1); 269ArrayPool<int>.Shared.Return(seenBuckets);
System\Collections\Frozen\FrozenSetInternalBase.cs (2)
200(rentedArray = ArrayPool<int>.Shared.Rent(intArrayLength)); 233ArrayPool<int>.Shared.Return(rentedArray);
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (2)
31int[] arrayPoolHashCodes = ArrayPool<int>.Shared.Rent(entries.Length); 47ArrayPool<int>.Shared.Return(arrayPoolHashCodes);
System\Collections\Frozen\Int32\Int32FrozenSet.cs (2)
25int[] entries = ArrayPool<int>.Shared.Rent(count); 30ArrayPool<int>.Shared.Return(entries);
System\Collections\Frozen\ItemsFrozenSet.cs (2)
26int[] arrayPoolHashCodes = ArrayPool<int>.Shared.Rent(entries.Length); 42ArrayPool<int>.Shared.Return(arrayPoolHashCodes);
System\Collections\Frozen\KeysAndValuesFrozenDictionary.cs (2)
28int[] arrayPoolHashCodes = ArrayPool<int>.Shared.Rent(entries.Length); 45ArrayPool<int>.Shared.Return(arrayPoolHashCodes);
System\Collections\Frozen\String\LengthBuckets.cs (4)
47int[] buckets = ArrayPool<int>.Shared.Rent(arraySize); 78ArrayPool<int>.Shared.Return(buckets); 86ArrayPool<int>.Shared.Return(buckets); 97ArrayPool<int>.Shared.Return(buckets);
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (2)
43int[] arrayPoolHashCodes = ArrayPool<int>.Shared.Rent(keys.Length); 60ArrayPool<int>.Shared.Return(arrayPoolHashCodes);
System\Collections\Frozen\String\OrdinalStringFrozenSet.cs (2)
34int[] arrayPoolHashCodes = ArrayPool<int>.Shared.Rent(entries.Length); 50ArrayPool<int>.Shared.Return(arrayPoolHashCodes);
System.Console (6)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System\IO\CachedConsoleStream.cs (2)
29Span<char> charSpan = maxCharCount <= 512 ? stackalloc char[512] : (pooledBuffer = ArrayPool<char>.Shared.Rent(maxCharCount)); 42ArrayPool<char>.Shared.Return(pooledBuffer);
System.Diagnostics.DiagnosticSource (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System.Diagnostics.Process (15)
src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcFsStat.TryReadStatusFile.cs (4)
121byte[] bytes = ArrayPool<byte>.Shared.Rent(4096); 140byte[] temp = ArrayPool<byte>.Shared.Rent(bytes.Length * 2); 144ArrayPool<byte>.Shared.Return(toReturn); 155ArrayPool<byte>.Shared.Return(bytes);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
64ArrayPool<byte>.Shared.Return(arrayBuffer); 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (2)
30_arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(maxSize); 46ArrayPool<byte>.Shared.Return(toReturn);
System\Diagnostics\Process.Linux.cs (3)
281byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 287ArrayPool<byte>.Shared.Return(toReturn); 335ArrayPool<byte>.Shared.Return(rentedArray);
System.Formats.Asn1 (2)
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (2)
13internal static byte[] Rent(int minimumLength) => ArrayPool<byte>.Shared.Rent(minimumLength); 37ArrayPool<byte>.Shared.Return(array, clearWholeArray);
System.Formats.Tar (33)
src\libraries\Common\src\System\IO\Archiving.Utils.cs (2)
24buffer = ArrayPool<char>.Shared.Rent(newCapacity); 25ArrayPool<char>.Shared.Return(oldBuffer);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System\Formats\Tar\TarHeader.Read.cs (10)
45byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 56ArrayPool<byte>.Shared.Return(rented); 575(buffer = ArrayPool<byte>.Shared.Rent((int)_size)); 583ArrayPool<byte>.Shared.Return(buffer); 597byte[] buffer = ArrayPool<byte>.Shared.Rent((int)_size); 603ArrayPool<byte>.Shared.Return(buffer); 645(buffer = ArrayPool<byte>.Shared.Rent((int)_size)); 653ArrayPool<byte>.Shared.Return(buffer); 668byte[] buffer = ArrayPool<byte>.Shared.Rent((int)_size); 674ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarHeader.Write.cs (5)
815byte[] buffer = ArrayPool<byte>.Shared.Rent(paddingAfterData); 820ArrayPool<byte>.Shared.Return(buffer); 861ArrayPool<byte>.Shared.Return(buffer); 863span = buffer = ArrayPool<byte>.Shared.Rent(length); 884ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarHelpers.cs (8)
61byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToDiscard)); 68ArrayPool<byte>.Shared.Return(buffer); 83byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToDiscard)); 90ArrayPool<byte>.Shared.Return(buffer); 97byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToCopy)); 105ArrayPool<byte>.Shared.Return(buffer); 113byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToCopy)); 122ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarWriter.cs (4)
322byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 339ArrayPool<byte>.Shared.Return(rented); 360byte[] twoEmptyRecords = ArrayPool<byte>.Shared.Rent(TwoRecordSize); 365ArrayPool<byte>.Shared.Return(twoEmptyRecords);
System.IO.Compression (6)
System\IO\Compression\DeflateZLib\DeflateStream.cs (6)
109_buffer = ArrayPool<byte>.Shared.Rent(DefaultBufferSize); 703ArrayPool<byte>.Shared.Return(buffer); 756ArrayPool<byte>.Shared.Return(buffer); 893_arrayPoolBuffer = ArrayPool<byte>.Shared.Rent(bufferSize); 928ArrayPool<byte>.Shared.Return(_arrayPoolBuffer); 962ArrayPool<byte>.Shared.Return(_arrayPoolBuffer);
System.IO.Compression.Brotli (2)
System\IO\Compression\BrotliStream.cs (2)
59_buffer = ArrayPool<byte>.Shared.Rent(DefaultInternalBufferSize); 133ArrayPool<byte>.Shared.Return(buffer);
System.IO.Compression.ZipFile (2)
src\libraries\Common\src\System\IO\Archiving.Utils.cs (2)
24buffer = ArrayPool<char>.Shared.Rent(newCapacity); 25ArrayPool<char>.Shared.Return(oldBuffer);
System.IO.FileSystem.Watcher (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System.IO.Hashing (4)
System\IO\Hashing\NonCryptographicHashAlgorithm.cs (4)
110byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 124ArrayPool<byte>.Shared.Return(buffer); 155byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 173ArrayPool<byte>.Shared.Return(buffer);
System.IO.Pipelines (4)
System\IO\Pipelines\BufferSegment.cs (1)
84ArrayPool<byte>.Shared.Return(_array);
System\IO\Pipelines\Pipe.cs (1)
253segment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(sizeToRequest));
System\IO\Pipelines\StreamPipeReader.cs (1)
528nextSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(sizeToRequest));
System\IO\Pipelines\StreamPipeWriter.cs (1)
167newSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(sizeToRequest));
System.Linq (4)
System\Linq\SegmentedArrayBuilder.cs (4)
73ArrayPool<T>.Shared.Return(segment); 79ArrayPool<T>.Shared.Return(currentSegment); 92ArrayPool<T>.Shared.Return(segment); 333_currentSegment = _segments[_segmentsCount] = ArrayPool<T>.Shared.Rent(newSegmentLength);
System.Memory (6)
System\Buffers\ArrayMemoryPool.ArrayMemoryPoolBuffer.cs (2)
14_array = ArrayPool<T>.Shared.Rent(size); 34ArrayPool<T>.Shared.Return(array);
System\Text\EncodingExtensions.cs (4)
178byte[] rentedArray = ArrayPool<byte>.Shared.Rent(byteCountThisIteration); 205ArrayPool<byte>.Shared.Return(array); 365char[] rentedArray = ArrayPool<char>.Shared.Rent(charCountThisIteration); 391ArrayPool<char>.Shared.Return(array);
System.Net.Http (34)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
39: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 132_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 156ArrayPool<byte>.Shared.Rent(newSize) : 185ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (1)
128private static ArrayPool<byte> Pool => ArrayPool<byte>.Shared;
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
53ArrayPool<byte>.Shared.Return(toReturn); 114ArrayPool<byte>.Shared.Return(toReturn); 231_blocks[allocatedBlockCount++] = ArrayPool<byte>.Shared.Rent(BlockSize);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System\Net\Http\Headers\HeaderDescriptor.cs (2)
262char[] rented = ArrayPool<char>.Shared.Rent(input.Length); 274ArrayPool<char>.Shared.Return(rented);
System\Net\Http\Headers\HeaderUtilities.cs (2)
71byte[] utf8bytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(input.Length)); 109ArrayPool<byte>.Shared.Return(utf8bytes);
System\Net\Http\HttpContent.cs (4)
945_buffer = ArrayPool<byte>.Shared.Rent((int)capacity); 952ArrayPool<byte>.Shared.Return(_buffer); 999byte[] newBuffer = ArrayPool<byte>.Shared.Rent(newCapacity); 1001ArrayPool<byte>.Shared.Return(currentBuffer);
System\Net\Http\MultipartContent.cs (2)
651: (rentedBuffer = ArrayPool<byte>.Shared.Rent(maxLength)); 662ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (2)
404HttpConnection[] stackCopy = ArrayPool<HttpConnection>.Shared.Rent(pool._associatedHttp11ConnectionCount); 429ArrayPool<HttpConnection>.Shared.Return(stackCopy);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (4)
1188byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 1218ArrayPool<byte>.Shared.Return(buffer); 1224byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 1254ArrayPool<byte>.Shared.Return(buffer);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (2)
1935byte[] pooledBuffer = ArrayPool<byte>.Shared.Rent(desiredBufferSize); 1955ArrayPool<byte>.Shared.Return(pooledBuffer);
System\Net\Http\SocketsHttpHandler\SocksHelper.cs (4)
67byte[] buffer = ArrayPool<byte>.Shared.Rent(BufferSize); 209ArrayPool<byte>.Shared.Return(buffer); 215byte[] buffer = ArrayPool<byte>.Shared.Rent(BufferSize); 316ArrayPool<byte>.Shared.Return(buffer);
System.Net.Mail (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System.Net.Ping (2)
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (2)
30_arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(maxSize); 46ArrayPool<byte>.Shared.Return(toReturn);
System.Net.Quic (15)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs (2)
34byte[] buffer = ArrayPool<byte>.Shared.Rent(1024); 43ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
39: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 132_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 156ArrayPool<byte>.Shared.Rent(newSize) : 185ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
53ArrayPool<byte>.Shared.Return(toReturn); 114ArrayPool<byte>.Shared.Return(toReturn); 231_blocks[allocatedBlockCount++] = ArrayPool<byte>.Shared.Rent(BlockSize);
System\Net\Quic\QuicConnection.SslConnectionOptions.cs (4)
102certDataRented = ArrayPool<byte>.Shared.Rent((int)certificateBuffer->Length); 109chainDataRented = ArrayPool<byte>.Shared.Rent((int)chainBuffer->Length); 148ArrayPool<byte>.Shared.Return(certDataRented); 153ArrayPool<byte>.Shared.Return(chainDataRented);
System\Net\Quic\QuicStream.Stream.cs (2)
118byte[] rentedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 137ArrayPool<byte>.Shared.Return(rentedBuffer);
System.Net.Security (22)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs (2)
34byte[] buffer = ArrayPool<byte>.Shared.Rent(1024); 43ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
39: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 132_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 156ArrayPool<byte>.Shared.Rent(newSize) : 185ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Net\Security\RC4.cs (2)
46state = ArrayPool<byte>.Shared.Rent(256); 71ArrayPool<byte>.Shared.Return(state);
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (2)
13internal static byte[] Rent(int minimumLength) => ArrayPool<byte>.Shared.Rent(minimumLength); 37ArrayPool<byte>.Shared.Return(array, clearWholeArray);
src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (3)
18char[] base64 = ArrayPool<char>.Shared.Rent(base64Len); 30char[] urlEncoded = ArrayPool<char>.Shared.Rent(urlEncodedLen); 76ArrayPool<char>.Shared.Return(base64);
System\Net\Security\SslStream.Protocol.cs (4)
1367Payload = RentBuffer ? ArrayPool<byte>.Shared.Rent(Size) : new byte[Size]; 1381Payload = RentBuffer ? ArrayPool<byte>.Shared.Rent(Size + size) : new byte[Size + size]; 1387ArrayPool<byte>.Shared.Return(oldPayload); 1406ArrayPool<byte>.Shared.Return(toReturn);
System\Net\Security\SslStreamCertificateContext.Linux.cs (5)
266IntPtr[] issuerHandles = ArrayPool<IntPtr>.Shared.Rent(_privateIntermediateCertificates.Length + 1); 284byte[] rentedBytes = ArrayPool<byte>.Shared.Rent(Interop.Crypto.GetOcspRequestDerSize(ocspRequest)); 327ArrayPool<IntPtr>.Shared.Return(issuerHandles); 328ArrayPool<byte>.Shared.Return(rentedBytes); 329ArrayPool<char>.Shared.Return(rentedChars.Array!);
System.Net.WebSockets (20)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (4)
37ArrayPool<byte>.Shared.Return(toReturn); 49_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(payload.Length, MinInitialBufferLength)); 67byte[] newBuffer = ArrayPool<byte>.Shared.Rent((int)(_buffer.Length * 1.3)); 73ArrayPool<byte>.Shared.Return(toReturn);
System\Net\WebSockets\Compression\WebSocketInflater.cs (5)
83_buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(userBufferLength, payloadLength)); 100_buffer = ArrayPool<byte>.Shared.Rent(FlushMarkerLength); 108byte[] newBuffer = ArrayPool<byte>.Shared.Rent(_available + FlushMarkerLength); 114ArrayPool<byte>.Shared.Return(toReturn); 209ArrayPool<byte>.Shared.Return(toReturn);
System\Net\WebSockets\ManagedWebSocket.cs (7)
1291byte[] closeBuffer = ArrayPool<byte>.Shared.Rent(MaxMessageHeaderLength + MaxControlPayloadLength); 1331ArrayPool<byte>.Shared.Return(closeBuffer); 1356buffer = ArrayPool<byte>.Shared.Rent(count); 1361buffer = ArrayPool<byte>.Shared.Rent(count); 1376ArrayPool<byte>.Shared.Return(buffer); 1451_sendBuffer = ArrayPool<byte>.Shared.Rent(minLength); 1462ArrayPool<byte>.Shared.Return(toReturn);
System\Net\WebSockets\WebSocket.cs (4)
43byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 52ArrayPool<byte>.Shared.Return(array); 72byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 80ArrayPool<byte>.Shared.Return(array);
System.Private.CoreLib (140)
src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcFsStat.TryReadStatusFile.cs (4)
121byte[] bytes = ArrayPool<byte>.Shared.Rent(4096); 140byte[] temp = ArrayPool<byte>.Shared.Rent(bytes.Length * 2); 144ArrayPool<byte>.Shared.Return(toReturn); 155ArrayPool<byte>.Shared.Return(bytes);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetCwd.cs (2)
30byte[] buf = ArrayPool<byte>.Shared.Rent(bufferSize); 44ArrayPool<byte>.Shared.Return(buf);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
64ArrayPool<byte>.Shared.Return(arrayBuffer); 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (2)
30_arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(maxSize); 46ArrayPool<byte>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (4)
894: (borrowedArray = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 916ArrayPool<byte>.Shared.Return(borrowedArray); 919sortKey = (borrowedArray = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 946ArrayPool<byte>.Shared.Return(borrowedArray);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (2)
158(borrowedArr = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 177ArrayPool<byte>.Shared.Return(borrowedArr);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Utf8.cs (7)
92sourceUtf16Array = ArrayPool<char>.Shared.Rent(sourceMaxCharCount); 103ArrayPool<char>.Shared.Return(sourceUtf16Array); 123prefixUtf16Array = ArrayPool<char>.Shared.Rent(prefixMaxCharCount); 135ArrayPool<char>.Shared.Return(prefixUtf16Array); 140ArrayPool<char>.Shared.Return(sourceUtf16Array); 155ArrayPool<char>.Shared.Return(prefixUtf16Array); 160ArrayPool<char>.Shared.Return(sourceUtf16Array);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (4)
55: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 95ArrayPool<char>.Shared.Return(temp); 98buffer = toReturn = ArrayPool<char>.Shared.Rent(realLen); 108ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (4)
74: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 106ArrayPool<char>.Shared.Return(temp); 109buffer = toReturn = ArrayPool<char>.Shared.Rent(realLength); 138ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
509byte[] buffer = ArrayPool<byte>.Shared.Rent(numBytes); 511ArrayPool<byte>.Shared.Return(buffer);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (10)
198rented = ArrayPool<byte>.Shared.Rent(maxByteCount); 207ArrayPool<byte>.Shared.Return(rented); 367byte[] rented = ArrayPool<byte>.Shared.Rent(value.Length * 3); // max expansion: each char -> 3 bytes 371ArrayPool<byte>.Shared.Return(rented); 392byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 400ArrayPool<byte>.Shared.Return(array); 430rented = ArrayPool<byte>.Shared.Rent(maxByteCount); 433ArrayPool<byte>.Shared.Return(rented); 443rented = ArrayPool<byte>.Shared.Rent(MaxArrayPoolRentalSize); 458ArrayPool<byte>.Shared.Return(rented);
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs (4)
47_pathBuffer = ArrayPool<char>.Shared.Rent(StandardBufferSize); 49_entryBuffer = size > 0 ? ArrayPool<byte>.Shared.Rent(size) : null; 246ArrayPool<char>.Shared.Return(pathBuffer); 252ArrayPool<byte>.Shared.Return(entryBuffer);
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (13)
936buffer = ArrayPool<char>.Shared.Rent(sr.CurrentEncoding.GetMaxCharCount(DefaultBufferSize)); 954ArrayPool<char>.Shared.Return(buffer); 1024byte[] rentedArray = ArrayPool<byte>.Shared.Rent(512); 1038byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 1044ArrayPool<byte>.Shared.Return(toReturn); 1059ArrayPool<byte>.Shared.Return(rentedArray); 1241byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 1247ArrayPool<byte>.Shared.Return(oldRentedArray); 1264ArrayPool<byte>.Shared.Return(rentedArray); 1289Span<byte> bytes = bytesNeeded <= 1024 ? stackalloc byte[1024] : (rentedBytes = ArrayPool<byte>.Shared.Rent(bytesNeeded)); 1321ArrayPool<byte>.Shared.Return(rentedBytes); 1344byte[] bytes = ArrayPool<byte>.Shared.Rent(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1374ArrayPool<byte>.Shared.Return(bytes);
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (12)
64byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 75ArrayPool<byte>.Shared.Return(buffer); 102byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 113ArrayPool<byte>.Shared.Return(buffer); 315byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 328ArrayPool<byte>.Shared.Return(localBuffer); 745byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 758ArrayPool<byte>.Shared.Return(localBuffer); 790byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 804ArrayPool<byte>.Shared.Return(sharedBuffer); 922byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 930ArrayPool<byte>.Shared.Return(sharedBuffer);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (5)
936ArrayPool<char>.Shared.Return(arrayPoolBuffer); 962arrayPoolBuffer = ArrayPool<char>.Shared.Rent(charLen - charPos + 80); 966char[] newBuffer = ArrayPool<char>.Shared.Rent(checked(arrayPoolBufferPos + charLen - charPos)); 968ArrayPool<char>.Shared.Return(arrayPoolBuffer); 979ArrayPool<char>.Shared.Return(arrayPoolBuffer);
src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (6)
98char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 112ArrayPool<char>.Shared.Return(array); 148char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 162ArrayPool<char>.Shared.Return(array); 244char[] chars = ArrayPool<char>.Shared.Rent(4096); 255ArrayPool<char>.Shared.Return(chars);
src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (4)
162char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 171ArrayPool<char>.Shared.Return(array); 366char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 375ArrayPool<char>.Shared.Return(array);
src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (2)
86Span<char> scratch = (uint)count <= 64 ? stackalloc char[64] : (borrowedArr = ArrayPool<char>.Shared.Rent(count)); 98ArrayPool<char>.Shared.Return(borrowedArr);
src\libraries\System.Private.CoreLib\src\System\Numerics\INumberBase.cs (15)
305utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 316ArrayPool<char>.Shared.Return(utf16TextArray); 331ArrayPool<char>.Shared.Return(utf16TextArray); 439utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 450ArrayPool<char>.Shared.Return(utf16TextArray); 466ArrayPool<char>.Shared.Return(utf16TextArray); 485utf16DestinationArray = ArrayPool<char>.Shared.Rent(destinationMaxCharCount); 494ArrayPool<char>.Shared.Return(utf16DestinationArray); 509ArrayPool<char>.Shared.Return(utf16DestinationArray); 541utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 552ArrayPool<char>.Shared.Return(utf16TextArray); 567ArrayPool<char>.Shared.Return(utf16TextArray); 588utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 599ArrayPool<char>.Shared.Return(utf16TextArray); 615ArrayPool<char>.Shared.Return(utf16TextArray);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (5)
58_chars = _arrayToReturnToPool = ArrayPool<char>.Shared.Rent(GetDefaultLength(literalLength, formattedCount)); 71_chars = _arrayToReturnToPool = ArrayPool<char>.Shared.Rent(GetDefaultLength(literalLength, formattedCount)); 125ArrayPool<char>.Shared.Return(toReturn); 634char[] newArray = ArrayPool<char>.Shared.Rent(arraySize); 642ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (2)
906stackalloc char[64] : (borrowedArr = ArrayPool<char>.Shared.Rent(length + 1)); 936ArrayPool<char>.Shared.Return(borrowedArr);
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (16)
310byte[] rentedBytes = ArrayPool<byte>.Shared.Rent(DefaultReadByteBufferSize); 311char[] rentedChars = ArrayPool<char>.Shared.Rent(_readCharBufferMaxSize); 343ArrayPool<byte>.Shared.Return(rentedBytes); 344ArrayPool<char>.Shared.Return(rentedChars); 389byte[] rentedBytes = ArrayPool<byte>.Shared.Rent(DefaultReadByteBufferSize); 390char[] rentedChars = ArrayPool<char>.Shared.Rent(_readCharBufferMaxSize); 422ArrayPool<byte>.Shared.Return(rentedBytes); 423ArrayPool<char>.Shared.Return(rentedChars); 486char[] scratchChars = ArrayPool<char>.Shared.Rent(rentalLength); 487byte[] scratchBytes = ArrayPool<byte>.Shared.Rent(rentalLength); 531ArrayPool<char>.Shared.Return(scratchChars); 532ArrayPool<byte>.Shared.Return(scratchBytes); 562char[] scratchChars = ArrayPool<char>.Shared.Rent(rentalLength); 563byte[] scratchBytes = ArrayPool<byte>.Shared.Rent(rentalLength); 603ArrayPool<char>.Shared.Return(scratchChars); 604ArrayPool<byte>.Shared.Return(scratchBytes);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (4)
698char[] array = ArrayPool<char>.Shared.Rent(length); 708ArrayPool<char>.Shared.Return(array); 745char[] array = ArrayPool<char>.Shared.Rent(length); 755ArrayPool<char>.Shared.Return(array);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (2)
272byte[] dirBuffer = ArrayPool<byte>.Shared.Rent(bufferSize); 356ArrayPool<byte>.Shared.Return(dirBuffer);
System.Private.CoreLib.Generators (3)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);
System.Private.Uri (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System.Private.Xml (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System.Reflection.Metadata (6)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System\Reflection\Internal\Utilities\EncodingHelper.netcoreapp.cs (2)
45byte[] buffer = ArrayPool<byte>.Shared.Rent(prefixedByteCount); 56ArrayPool<byte>.Shared.Return(buffer);
System.Runtime.Numerics (144)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);
System\Number.BigInteger.cs (19)
94buffer = arrayFromPool = ArrayPool<byte>.Shared.Rent(value.Length + 1 + 1); 116ArrayPool<byte>.Shared.Return(arrayFromPool); 342ArrayPool<int>.Shared.Return(arrayFromPoolForResultBuffer); 437arrayFromPoolForResultBuffer = ArrayPool<int>.Shared.Rent(bufferSize); 489arrayFromPoolForMultiplier = ArrayPool<int>.Shared.Rent(blockSize); 551arrayFromPoolForMultiplier = ArrayPool<int>.Shared.Rent(blockSize); 558ArrayPool<int>.Shared.Return(arrayToReturn); 580ArrayPool<int>.Shared.Return(arrayFromPoolForMultiplier); 645arrayFromPoolForResultBuffer = ArrayPool<int>.Shared.Rent(checked(currentBufferSize * 2)); 652ArrayPool<int>.Shared.Return(arrayToReturn); 670bits = arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(bytesWrittenOrNeeded); 728ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 751bytes = arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(bytesWrittenOrNeeded); 767ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 830ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 906(bufferToReturn = ArrayPool<uint>.Shared.Rent(cuMax)); 984(numberBufferToReturn = ArrayPool<byte>.Shared.Rent(valueDigits + 1)); 1020ArrayPool<byte>.Shared.Return(numberBufferToReturn); 1027ArrayPool<uint>.Shared.Return(bufferToReturn);
System\Numerics\BigInteger.cs (74)
769: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 782ArrayPool<uint>.Shared.Return(bitsFromPool); 799: remainderFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 805: quotientFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 813ArrayPool<uint>.Shared.Return(remainderFromPool); 816ArrayPool<uint>.Shared.Return(quotientFromPool); 922: bitsFromPool = ArrayPool<uint>.Shared.Rent(leftBits.Length)).Slice(0, leftBits.Length); 935: bitsFromPool = ArrayPool<uint>.Shared.Rent(leftBits.Length)).Slice(0, leftBits.Length); 942ArrayPool<uint>.Shared.Return(bitsFromPool); 990: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1015ArrayPool<uint>.Shared.Return(bitsFromPool); 1050: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1061: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1069ArrayPool<uint>.Shared.Return(bitsFromPool); 1651: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1663: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1675: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1687: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1694ArrayPool<uint>.Shared.Return(bitsFromPool); 1729: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1741: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1751: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1763: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 1770ArrayPool<uint>.Shared.Return(bitsFromPool); 2340: leftBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2347: rightBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2354: resultBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2364ArrayPool<uint>.Shared.Return(leftBufferFromPool); 2367ArrayPool<uint>.Shared.Return(rightBufferFromPool); 2372ArrayPool<uint>.Shared.Return(resultBufferFromPool); 2396: leftBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2403: rightBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2410: resultBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2420ArrayPool<uint>.Shared.Return(leftBufferFromPool); 2423ArrayPool<uint>.Shared.Return(rightBufferFromPool); 2428ArrayPool<uint>.Shared.Return(resultBufferFromPool); 2447: leftBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2454: rightBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2461: resultBufferFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2471ArrayPool<uint>.Shared.Return(leftBufferFromPool); 2474ArrayPool<uint>.Shared.Return(rightBufferFromPool); 2479ArrayPool<uint>.Shared.Return(resultBufferFromPool); 2501: xdFromPool = ArrayPool<uint>.Shared.Rent(xl)).Slice(0, xl); 2508: zdFromPool = ArrayPool<uint>.Shared.Rent(zl)).Slice(0, zl); 2536ArrayPool<uint>.Shared.Return(xdFromPool); 2538ArrayPool<uint>.Shared.Return(zdFromPool); 2562: xdFromPool = ArrayPool<uint>.Shared.Rent(xl)).Slice(0, xl); 2590: zdFromPool = ArrayPool<uint>.Shared.Rent(zl)).Slice(0, zl); 2628ArrayPool<uint>.Shared.Return(zdFromPool); 2631ArrayPool<uint>.Shared.Return(xdFromPool); 2704: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2716: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2726: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2738: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2751: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2759ArrayPool<uint>.Shared.Return(bitsFromPool); 2793: quotientFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2804ArrayPool<uint>.Shared.Return(quotientFromPool); 2819: quotientFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2825ArrayPool<uint>.Shared.Return(quotientFromPool); 2869: bitsFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 2875ArrayPool<uint>.Shared.Return(bitsFromPool); 3253: xdFromPool = ArrayPool<uint>.Shared.Rent(xl); 3263: zdFromPool = ArrayPool<uint>.Shared.Rent(zl); 3356ArrayPool<uint>.Shared.Return(xdFromPool); 3358ArrayPool<uint>.Shared.Return(zdFromPool); 3388: xdFromPool = ArrayPool<uint>.Shared.Rent(xl); 3398: zdFromPool = ArrayPool<uint>.Shared.Rent(zl); 3490ArrayPool<uint>.Shared.Return(xdFromPool); 3492ArrayPool<uint>.Shared.Return(zdFromPool); 5233: xdFromPool = ArrayPool<uint>.Shared.Rent(xl)).Slice(0, xl); 5252: zdFromPool = ArrayPool<uint>.Shared.Rent(zl)).Slice(0, zl); 5286ArrayPool<uint>.Shared.Return(zdFromPool); 5289ArrayPool<uint>.Shared.Return(xdFromPool);
System\Numerics\BigIntegerCalculator.DivRem.cs (2)
91: leftCopyFromPool = ArrayPool<uint>.Shared.Rent(left.Length)).Slice(0, left.Length); 97ArrayPool<uint>.Shared.Return(leftCopyFromPool);
System\Numerics\BigIntegerCalculator.GcdInv.cs (2)
69: rightCopyFromPool = ArrayPool<uint>.Shared.Rent(right.Length)).Slice(0, right.Length); 75ArrayPool<uint>.Shared.Return(rightCopyFromPool);
System\Numerics\BigIntegerCalculator.PowMod.cs (28)
28: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 34: valueCopyFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 43ArrayPool<uint>.Shared.Return(tempFromPool); 45ArrayPool<uint>.Shared.Return(valueCopyFromPool); 221: valueCopyFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 240: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 246ArrayPool<uint>.Shared.Return(valueCopyFromPool); 248ArrayPool<uint>.Shared.Return(tempFromPool); 270: valueCopyFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 289: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 295ArrayPool<uint>.Shared.Return(valueCopyFromPool); 297ArrayPool<uint>.Shared.Return(tempFromPool); 328: rFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 335: muFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 342: q1FromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 348: q2FromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 354ArrayPool<uint>.Shared.Return(rFromPool); 361ArrayPool<uint>.Shared.Return(muFromPool); 363ArrayPool<uint>.Shared.Return(q1FromPool); 365ArrayPool<uint>.Shared.Return(q2FromPool); 388: rFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 395: muFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 402: q1FromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 408: q2FromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); 414ArrayPool<uint>.Shared.Return(rFromPool); 421ArrayPool<uint>.Shared.Return(muFromPool); 423ArrayPool<uint>.Shared.Return(q1FromPool); 425ArrayPool<uint>.Shared.Return(q2FromPool);
System\Numerics\BigIntegerCalculator.SquMul.cs (12)
102: foldFromPool = ArrayPool<uint>.Shared.Rent(foldLength)).Slice(0, foldLength); 109: coreFromPool = ArrayPool<uint>.Shared.Rent(coreLength)).Slice(0, coreLength); 119ArrayPool<uint>.Shared.Return(foldFromPool); 127ArrayPool<uint>.Shared.Return(coreFromPool); 227: carryFromPool = ArrayPool<uint>.Shared.Rent(carryLength)).Slice(0, carryLength); 242ArrayPool<uint>.Shared.Return(carryFromPool); 286: leftFoldFromPool = ArrayPool<uint>.Shared.Rent(foldLength)).Slice(0, foldLength); 292: rightFoldFromPool = ArrayPool<uint>.Shared.Rent(foldLength)).Slice(0, foldLength); 305: coreFromPool = ArrayPool<uint>.Shared.Rent(coreLength)).Slice(0, coreLength); 312ArrayPool<uint>.Shared.Return(leftFoldFromPool); 315ArrayPool<uint>.Shared.Return(rightFoldFromPool); 326ArrayPool<uint>.Shared.Return(coreFromPool);
System.Security.Cryptography (86)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
64ArrayPool<byte>.Shared.Return(arrayBuffer); 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs (2)
34byte[] buffer = ArrayPool<byte>.Shared.Rent(1024); 43ArrayPool<byte>.Shared.Return(buffer);
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (2)
13internal static byte[] Rent(int minimumLength) => ArrayPool<byte>.Shared.Rent(minimumLength); 37ArrayPool<byte>.Shared.Return(array, clearWholeArray);
src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (3)
18char[] base64 = ArrayPool<char>.Shared.Rent(base64Len); 30char[] urlEncoded = ArrayPool<char>.Shared.Rent(urlEncodedLen); 76ArrayPool<char>.Shared.Return(base64);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (2)
30_arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(maxSize); 46ArrayPool<byte>.Shared.Return(toReturn);
System\Security\Cryptography\CryptoStream.cs (14)
345byte[] tempInputBuffer = ArrayPool<byte>.Shared.Rent(numWholeBlocksInBytes); 387byte[] tempOutputBuffer = ArrayPool<byte>.Shared.Rent(numWholeReadBlocks * _outputBlockSize); 397ArrayPool<byte>.Shared.Return(tempOutputBuffer); 418ArrayPool<byte>.Shared.Return(tempInputBuffer); 508byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 521ArrayPool<byte>.Shared.Return(sharedBuffer); 593byte[]? tempOutputBuffer = ArrayPool<byte>.Shared.Rent(checked(numWholeBlocks * _outputBlockSize)); 612ArrayPool<byte>.Shared.Return(tempOutputBuffer); 660byte[]? rentedBuffer = ArrayPool<byte>.Shared.Rent(inputBuffer.Length); 677ArrayPool<byte>.Shared.Return(rentedBuffer); 690byte[]? rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferSize); 708ArrayPool<byte>.Shared.Return(rentedBuffer); 722byte[]? rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferSize); 739ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Security\Cryptography\DSA.cs (2)
898byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 913ArrayPool<byte>.Shared.Return(array);
System\Security\Cryptography\ECDsa.cs (8)
150rented = ArrayPool<byte>.Shared.Rent(maxSignatureSize); 174ArrayPool<byte>.Shared.Return(rented); 432rented = ArrayPool<byte>.Shared.Rent(maxSignatureSize); 456ArrayPool<byte>.Shared.Return(rented); 1009byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 1036ArrayPool<byte>.Shared.Return(array); 1218byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 1233ArrayPool<byte>.Shared.Return(array);
System\Security\Cryptography\HashAlgorithm.cs (6)
97byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 113ArrayPool<byte>.Shared.Return(buffer, clearArray: false); 133byte[] rented = ArrayPool<byte>.Shared.Rent(4096); 149ArrayPool<byte>.Shared.Return(rented, clearArray: false); 254byte[] array = ArrayPool<byte>.Shared.Rent(source.Length); 258ArrayPool<byte>.Shared.Return(array);
System\Security\Cryptography\RandomNumberGenerator.cs (4)
59byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 68ArrayPool<byte>.Shared.Return(array); 82byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 94ArrayPool<byte>.Shared.Return(array);
System\Security\Cryptography\RSA.cs (4)
318byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 327ArrayPool<byte>.Shared.Return(array); 1449byte[] rented = ArrayPool<byte>.Shared.Rent(resultSize); 1465ArrayPool<byte>.Shared.Return(rented);
System\Security\Cryptography\SymmetricAlgorithm.cs (2)
723byte[] decryptRent = ArrayPool<byte>.Shared.Rent(ciphertext.Length); 737ArrayPool<byte>.Shared.Return(decryptRent);
System\Security\Cryptography\X509Certificates\CertificateRequest.Load.cs (2)
50byte[] rented = ArrayPool<byte>.Shared.Rent(fields.DecodedDataLength); 71ArrayPool<byte>.Shared.Return(rented);
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (2)
272byte[] rented = ArrayPool<byte>.Shared.Rent(fields.DecodedDataLength); 286ArrayPool<byte>.Shared.Return(rented);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (5)
789ArrayPool<char>.Shared.Return(urlEncoded.Array!); 1356ArrayPool<ErrorCollection>.Shared.Return(toReturn); 1384_errors = ArrayPool<ErrorCollection>.Shared.Rent(size); 1392_errors = ArrayPool<ErrorCollection>.Shared.Rent(errorDepth + 1); 1397ArrayPool<ErrorCollection>.Shared.Return(toReturn);
System\Security\Cryptography\X509Certificates\UnixExportProvider.cs (6)
95CertBagAsn[] certBags = ArrayPool<CertBagAsn>.Shared.Rent(certCount); 96SafeBagAsn[] keyBags = ArrayPool<SafeBagAsn>.Shared.Rent(certCount); 97AttributeAsn[] certAttrs = ArrayPool<AttributeAsn>.Shared.Rent(certCount); 162ArrayPool<AttributeAsn>.Shared.Return(certAttrs); 163ArrayPool<CertBagAsn>.Shared.Return(certBags); 164ArrayPool<SafeBagAsn>.Shared.Return(keyBags);
System\Security\Cryptography\X509Certificates\UnixPkcs12Reader.cs (16)
162ArrayPool<CertAndKey>.Shared.Return(rentedCerts, clearArray: true); 191ArrayPool<ContentInfoAsn>.Shared.Return(rentedContents, clearArray: true); 299CertBagAsn[] certBags = ArrayPool<CertBagAsn>.Shared.Rent(10); 300AttributeAsn[]?[] certBagAttrs = ArrayPool<AttributeAsn[]?>.Shared.Rent(10); 301SafeBagAsn[] keyBags = ArrayPool<SafeBagAsn>.Shared.Rent(10); 318certs = ArrayPool<CertAndKey>.Shared.Rent(certBagIdx); 321keys = ArrayPool<AsymmetricAlgorithm>.Shared.Rent(keyBagIdx); 324publicKeyInfos = ArrayPool<RentedSubjectPublicKeyInfo>.Shared.Rent(keyBagIdx); 365ArrayPool<AsymmetricAlgorithm>.Shared.Return(keys); 375ArrayPool<RentedSubjectPublicKeyInfo>.Shared.Return(publicKeyInfos, clearArray: true); 378ArrayPool<CertBagAsn>.Shared.Return(certBags, clearArray: true); 379ArrayPool<AttributeAsn[]?>.Shared.Return(certBagAttrs, clearArray: true); 380ArrayPool<SafeBagAsn>.Shared.Return(keyBags, clearArray: true); 388ContentInfoAsn[] rented = ArrayPool<ContentInfoAsn>.Shared.Rent(10); 813T[] newRent = ArrayPool<T>.Shared.Rent(oldRent.Length * 2); 816ArrayPool<T>.Shared.Return(oldRent, clearArray: true);
System.Security.Cryptography.Cose (16)
System\Security\Cryptography\Cose\CoseMessage.cs (4)
437byte[] contentBuffer = ArrayPool<byte>.Shared.Rent(4096); 449ArrayPool<byte>.Shared.Return(contentBuffer, clearArray: true); 473byte[] contentBuffer = ArrayPool<byte>.Shared.Rent(4096); 484ArrayPool<byte>.Shared.Return(contentBuffer, clearArray: true);
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (4)
793byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer))); 812ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 869byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer))); 883ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System\Security\Cryptography\Cose\CoseSign1Message.cs (4)
629byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 638ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 730byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 735ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System\Security\Cryptography\Cose\CoseSignature.cs (4)
405byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 414ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 437byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 446ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System.Text.Encodings.Web (6)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
System\Text\Encodings\Web\TextEncoder.cs (2)
521char[] rentedArray = ArrayPool<char>.Shared.Rent(Math.Max(value.Length, minBufferBumpEachIteration)); 536ArrayPool<char>.Shared.Return(rentedArray);
System.Text.Json (192)
src\libraries\Common\src\System\Text\Json\PooledByteBufferWriter.cs (6)
40_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity); 93ArrayPool<byte>.Shared.Return(toReturn); 116ArrayPool<byte>.Shared.Return(toReturn); 124_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity); 206_rentedBuffer = ArrayPool<byte>.Shared.Rent(newSize); 214ArrayPool<byte>.Shared.Return(oldBuffer);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (4)
43: (rentedBuffer = ArrayPool<char>.Shared.Rent(initialBufferLength)); 141ArrayPool<char>.Shared.Return(rentedBuffer); 160char[] newBuffer = ArrayPool<char>.Shared.Rent(newSize); 166ArrayPool<char>.Shared.Return(rentedBuffer);
System\Text\Json\Document\JsonDocument.cs (5)
81ArrayPool<byte>.Shared.Return(extraRentedBytes); 295(otherUtf8TextArray = ArrayPool<byte>.Shared.Rent(length)); 313ArrayPool<byte>.Shared.Return(otherUtf8TextArray); 862byte[] rent = ArrayPool<byte>.Shared.Rent(length); 873ArrayPool<byte>.Shared.Return(rented.Array);
System\Text\Json\Document\JsonDocument.MetadataDb.cs (7)
138byte[] data = ArrayPool<byte>.Shared.Rent(initialSize); 164ArrayPool<byte>.Shared.Return(data); 187ArrayPool<byte>.Shared.Return(returnBuf); 197byte[] newRent = ArrayPool<byte>.Shared.Rent(Length); 210ArrayPool<byte>.Shared.Return(returnBuf); 257_data = ArrayPool<byte>.Shared.Rent(newCapacity); 263ArrayPool<byte>.Shared.Return(toReturn);
System\Text\Json\Document\JsonDocument.Parse.cs (22)
87byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(length); 98ArrayPool<byte>.Shared.Return(utf8Bytes); 135ArrayPool<byte>.Shared.Return(drained.Array); 161ArrayPool<byte>.Shared.Return(drained.Array); 224ArrayPool<byte>.Shared.Return(drained.Array); 242ArrayPool<byte>.Shared.Return(drained.Array); 270byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(expectedByteCount); 286ArrayPool<byte>.Shared.Return(utf8Bytes); 296byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(expectedByteCount); 310ArrayPool<byte>.Shared.Return(utf8Bytes); 627byte[] rented = ArrayPool<byte>.Shared.Rent(length); 649ArrayPool<byte>.Shared.Return(rented); 775rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); 779rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); 810rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2)); 813ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); 828ArrayPool<byte>.Shared.Return(rented); 858rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); 862rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); 898rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2); 901ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); 926ArrayPool<byte>.Shared.Return(rented);
System\Text\Json\Document\JsonDocument.StackRowStack.cs (4)
23_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialSize); 38ArrayPool<byte>.Shared.Return(toReturn); 66_rentedBuffer = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2); 80ArrayPool<byte>.Shared.Return(toReturn);
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (4)
77byte[] tmpUtf8 = ArrayPool<byte>.Shared.Rent(maxBytes); 98ArrayPool<byte>.Shared.Return(tmpUtf8); 189(rented = ArrayPool<byte>.Shared.Rent(remaining)); 207ArrayPool<byte>.Shared.Return(rented);
System\Text\Json\JsonEncodedText.cs (2)
88(array = ArrayPool<byte>.Shared.Rent(expectedByteCount)); 102ArrayPool<byte>.Shared.Return(array);
System\Text\Json\JsonHelpers.Escaping.cs (4)
42(valueArray = ArrayPool<byte>.Shared.Rent(length)); 50ArrayPool<byte>.Shared.Return(valueArray); 70(valueArray = ArrayPool<byte>.Shared.Rent(length)); 78ArrayPool<byte>.Shared.Return(valueArray);
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (15)
20(unescapedArray = ArrayPool<byte>.Shared.Rent(utf8Source.Length)); 33ArrayPool<byte>.Shared.Return(unescapedArray); 50(pooledName = ArrayPool<byte>.Shared.Rent(length)); 63ArrayPool<byte>.Shared.Return(pooledName); 77(pooledName = ArrayPool<byte>.Shared.Rent(length)); 88ArrayPool<byte>.Shared.Return(pooledName); 102(unescapedArray = ArrayPool<byte>.Shared.Rent(utf8Source.Length)); 115ArrayPool<byte>.Shared.Return(unescapedArray); 133(unescapedArray = ArrayPool<byte>.Shared.Rent(length)); 137(escapedArray = ArrayPool<byte>.Shared.Rent(length)); 154ArrayPool<byte>.Shared.Return(unescapedArray); 156ArrayPool<byte>.Shared.Return(escapedArray); 180(pooledArray = ArrayPool<byte>.Shared.Rent(utf8Unescaped.Length)); 191ArrayPool<byte>.Shared.Return(pooledArray); 203ArrayPool<byte>.Shared.Return(pooledArray);
System\Text\Json\Reader\Utf8JsonReader.cs (2)
543otherUtf8TextArray = ArrayPool<byte>.Shared.Rent(length); 567ArrayPool<byte>.Shared.Return(otherUtf8TextArray);
System\Text\Json\Reader\Utf8JsonReader.TryGet.cs (5)
158(rentedBuffer = ArrayPool<byte>.Shared.Rent(valueLength)); 173(rentedBuffer = ArrayPool<byte>.Shared.Rent(valueLength)); 189ArrayPool<byte>.Shared.Return(rentedBuffer); 210(rentedBuffer = ArrayPool<byte>.Shared.Rent(sequenceLength)); 225ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (8)
109ArrayPool<FoundProperty>.Shared.Return(toReturn, clearArray: true); 247ArrayPool<FoundPropertyAsync>.Shared.Return(toReturn, clearArray: true); 353ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache!.Count)); 360var newCache = ArrayPool<FoundProperty>.Shared.Rent(argumentState.FoundProperties.Length * 2); 367ArrayPool<FoundProperty>.Shared.Return(toReturn, clearArray: true); 561argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache!.Count)); 567var newCache = ArrayPool<FoundPropertyAsync>.Shared.Rent(argumentState.FoundPropertiesAsync!.Length * 2); 574ArrayPool<FoundPropertyAsync>.Shared.Return(toReturn, clearArray: true);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.Large.cs (2)
46ArrayPool<object>.Shared.Return(arguments, clearArray: true); 57object?[] arguments = ArrayPool<object>.Shared.Rent(cache.Count);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (2)
378: (rentedBuffer = ArrayPool<char>.Shared.Rent(bufferLength)); 400ArrayPool<char>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Value\HalfConverter.cs (2)
43: (rentedByteBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 51ArrayPool<byte>.Shared.Return(rentedByteBuffer);
System\Text\Json\Serialization\Converters\Value\Int128Converter.cs (2)
42: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 59ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (2)
42: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 58ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\JsonSerializer.Read.String.cs (4)
436json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 452ArrayPool<byte>.Shared.Return(tempArray); 467json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 483ArrayPool<byte>.Shared.Return(tempArray);
System\Text\Json\Serialization\ReadBufferState.cs (4)
25_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length)); 120byte[] newBuffer = ArrayPool<byte>.Shared.Rent((_buffer.Length < (int.MaxValue / 2)) ? _buffer.Length * 2 : int.MaxValue); 129ArrayPool<byte>.Shared.Return(oldBuffer); 170ArrayPool<byte>.Shared.Return(toReturn);
System\Text\Json\Writer\Utf8JsonWriter.cs (4)
719(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 727ArrayPool<byte>.Shared.Return(propertyArray); 874(propertyArray = ArrayPool<char>.Shared.Rent(length)); 882ArrayPool<char>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (4)
148(propertyArray = ArrayPool<char>.Shared.Rent(length)); 156ArrayPool<char>.Shared.Return(propertyArray); 171(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 179ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (4)
155(propertyArray = ArrayPool<char>.Shared.Rent(length)); 163ArrayPool<char>.Shared.Return(propertyArray); 178(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 186ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (4)
154(propertyArray = ArrayPool<char>.Shared.Rent(length)); 162ArrayPool<char>.Shared.Return(propertyArray); 177(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 185ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (4)
154(propertyArray = ArrayPool<char>.Shared.Rent(length)); 162ArrayPool<char>.Shared.Return(propertyArray); 177(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 185ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.cs (4)
158(propertyArray = ArrayPool<char>.Shared.Rent(length)); 166ArrayPool<char>.Shared.Return(propertyArray); 181(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 189ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Float.cs (4)
158(propertyArray = ArrayPool<char>.Shared.Rent(length)); 166ArrayPool<char>.Shared.Return(propertyArray); 181(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 189ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.FormattedNumber.cs (4)
125(propertyArray = ArrayPool<char>.Shared.Rent(length)); 133ArrayPool<char>.Shared.Return(propertyArray); 148(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 156ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Guid.cs (4)
154(propertyArray = ArrayPool<char>.Shared.Rent(length)); 162ArrayPool<char>.Shared.Return(propertyArray); 177(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 185ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (4)
276(propertyArray = ArrayPool<char>.Shared.Rent(length)); 284ArrayPool<char>.Shared.Return(propertyArray); 299(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 307ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (4)
230(propertyArray = ArrayPool<char>.Shared.Rent(length)); 238ArrayPool<char>.Shared.Return(propertyArray); 253(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 261ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (28)
126propertyArray = ArrayPool<char>.Shared.Rent(length); 142ArrayPool<char>.Shared.Return(propertyArray); 285propertyArray = ArrayPool<byte>.Shared.Rent(length); 301ArrayPool<byte>.Shared.Return(propertyArray); 920(valueArray = ArrayPool<byte>.Shared.Rent(length)); 928ArrayPool<byte>.Shared.Return(valueArray); 943(valueArray = ArrayPool<char>.Shared.Rent(length)); 951ArrayPool<char>.Shared.Return(valueArray); 966(propertyArray = ArrayPool<char>.Shared.Rent(length)); 974ArrayPool<char>.Shared.Return(propertyArray); 989(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 997ArrayPool<byte>.Shared.Return(propertyArray); 1092valueArray = ArrayPool<char>.Shared.Rent(length); 1112propertyArray = ArrayPool<char>.Shared.Rent(length); 1128ArrayPool<char>.Shared.Return(valueArray); 1133ArrayPool<char>.Shared.Return(propertyArray); 1152valueArray = ArrayPool<byte>.Shared.Rent(length); 1172propertyArray = ArrayPool<byte>.Shared.Rent(length); 1188ArrayPool<byte>.Shared.Return(valueArray); 1193ArrayPool<byte>.Shared.Return(propertyArray); 1212valueArray = ArrayPool<byte>.Shared.Rent(length); 1232propertyArray = ArrayPool<char>.Shared.Rent(length); 1248ArrayPool<byte>.Shared.Return(valueArray); 1253ArrayPool<char>.Shared.Return(propertyArray); 1272valueArray = ArrayPool<char>.Shared.Rent(length); 1292propertyArray = ArrayPool<byte>.Shared.Rent(length); 1308ArrayPool<char>.Shared.Return(valueArray); 1313ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (4)
239(propertyArray = ArrayPool<char>.Shared.Rent(length)); 247ArrayPool<char>.Shared.Return(propertyArray); 262(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 270ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (2)
210json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 226ArrayPool<byte>.Shared.Return(tempArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (4)
194(valueArray = ArrayPool<char>.Shared.Rent(length)); 202ArrayPool<char>.Shared.Return(valueArray); 341(valueArray = ArrayPool<byte>.Shared.Rent(length)); 349ArrayPool<byte>.Shared.Return(valueArray);
System.Text.Json.SourceGeneration (4)
src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (4)
43: (rentedBuffer = ArrayPool<char>.Shared.Rent(initialBufferLength)); 141ArrayPool<char>.Shared.Return(rentedBuffer); 160char[] newBuffer = ArrayPool<char>.Shared.Rent(newSize); 166ArrayPool<char>.Shared.Return(rentedBuffer);
System.Text.RegularExpressions (11)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);
System\Text\StructListBuilder.cs (4)
14/// <summary>The array backing the builder, obtained from <see cref="ArrayPool{T}.Shared"/>.</summary> 51ArrayPool<T>.Shared.Return(_array, clearArray: RuntimeHelpers.IsReferenceOrContainsReferences<T>()); 66T[] newArray = _array = ArrayPool<T>.Shared.Rent(newSize); 68ArrayPool<T>.Shared.Return(array, clearArray: RuntimeHelpers.IsReferenceOrContainsReferences<T>());
System.Text.RegularExpressions.Generator (7)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
28_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 310char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 318ArrayPool<char>.Shared.Return(toReturn); 329ArrayPool<char>.Shared.Return(toReturn);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
165ArrayPool<T>.Shared.Return(toReturn); 193T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 200ArrayPool<T>.Shared.Return(toReturn);