1791 references to Shared
aspire (4)
Acquisition\PeerInstallProbe.cs (2)
350var buffer = ArrayPool<byte>.Shared.Rent(4096); 392ArrayPool<byte>.Shared.Return(buffer);
Documentation\Docs\LlmsTxtParser.cs (2)
930var buffer = ArrayPool<char>.Shared.Rent(title.Length); 961ArrayPool<char>.Shared.Return(buffer);
Aspire.Dashboard (6)
src\Shared\CompareHelpers.cs (2)
25(requestPooled = ArrayPool<byte>.Shared.Rent(requestByteCount))).Slice(0, requestByteCount); 38ArrayPool<byte>.Shared.Return(requestPooled);
Terminal\TerminalWebSocketProxy.cs (4)
284var buffer = ArrayPool<byte>.Shared.Rent(InboundBufferSize); 325ArrayPool<byte>.Shared.Return(buffer); 335var buffer = ArrayPool<byte>.Shared.Rent(OutboundBufferSize); 429ArrayPool<byte>.Shared.Return(buffer);
Aspire.Hosting (2)
src\Shared\CompareHelpers.cs (2)
25(requestPooled = ArrayPool<byte>.Shared.Rent(requestByteCount))).Slice(0, requestByteCount); 38ArrayPool<byte>.Shared.Return(requestPooled);
dotnet (8)
Commands\Test\MTP\IPC\Serializers\BaseSerializer.cs (8)
15byte[] bytes = ArrayPool<byte>.Shared.Rent(stringLen); 23ArrayPool<byte>.Shared.Return(bytes); 29byte[] bytes = ArrayPool<byte>.Shared.Rent(size); 37ArrayPool<byte>.Shared.Return(bytes); 44byte[] bytes = ArrayPool<byte>.Shared.Rent(stringutf8TotalBytes); 56ArrayPool<byte>.Shared.Return(bytes); 63byte[] bytes = ArrayPool<byte>.Shared.Rent(stringutf8TotalBytes); 71ArrayPool<byte>.Shared.Return(bytes);
GenerateDocumentationAndConfigFiles (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
ILCompiler.Compiler (8)
Compiler\ObjectWriter\Dwarf\DwarfFde.cs (2)
48var cfiCode = ArrayPool<byte>.Shared.Rent(4096); 127ArrayPool<byte>.Shared.Return(cfiCode);
Compiler\ObjectWriter\Eabi\EabiUnwindConverter.cs (2)
39byte[] unwindData = ArrayPool<byte>.Shared.Rent(1024); 134ArrayPool<byte>.Shared.Return(unwindData);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
ILCompiler.TypeSystem (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
illink (4)
ILLink.RoslynAnalyzer (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
Microsoft.AspNetCore.Antiforgery (10)
Internal\DefaultAntiforgeryTokenSerializer.cs (4)
39: (tokenBytesRent = ArrayPool<byte>.Shared.Rent(maxTokenDecodedSize)); 81ArrayPool<byte>.Shared.Return(tokenBytesRent); 220: (tokenBytesRent = ArrayPool<byte>.Shared.Rent(totalSize)); 270ArrayPool<byte>.Shared.Return(tokenBytesRent);
Internal\DefaultClaimUidExtractor.cs (2)
130: (rentedBuffer = ArrayPool<byte>.Shared.Rent(totalSize)); 148ArrayPool<byte>.Shared.Return(rentedBuffer);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.Components (14)
NavigationManager.cs (2)
463var locationChangingHandlersCopy = ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Rent(handlerCount); 509ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Return(locationChangingHandlersCopy);
PersistentState\PersistentStateValueProviderKeyResolver.cs (4)
122ArrayPool<byte>.Shared.Return(pool, clearArray: true); 135var newPool = pool == null ? ArrayPool<byte>.Shared.Rent(size ?? 2048) : ArrayPool<byte>.Shared.Rent(pool.Length * 2); 140ArrayPool<byte>.Shared.Return(pool, clearArray: true);
Routing\RouteContext.cs (2)
61_pooled = ArrayPool<byte>.Shared.Rent(length); 71ArrayPool<byte>.Shared.Return(_pooled);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
49_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 30_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 108ArrayPool<T>.Shared.Return(_rentedBuffer); 194_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 202ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.Components.Endpoints (26)
Builder\ResourceCollectionUrlEndpoint.cs (2)
183ArrayPool<byte>.Shared.Return(rented); 185rented = ArrayPool<byte>.Shared.Rent(length);
CacheView\CacheViewKeyResolver.cs (2)
281: (rented = System.Buffers.ArrayPool<byte>.Shared.Rent(byteCount)); 288System.Buffers.ArrayPool<byte>.Shared.Return(rented);
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); 153ArrayPool<char>.Shared.Return(buffer);
FormMapping\PrefixResolver.cs (2)
17_sortedKeys = ArrayPool<FormKey>.Shared.Rent(count); 41ArrayPool<FormKey>.Shared.Return(_sortedKeys);
RazorComponentEndpointInvoker.cs (2)
89await using var writer = new HttpResponseStreamWriter(context.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared);
Rendering\EndpointHtmlRenderer.EventDispatch.cs (4)
100await using var writer = new HttpResponseStreamWriter(_httpContext.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared); 132await using var writer = new HttpResponseStreamWriter(_httpContext.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared);
Results\RazorComponentResultExecutor.cs (2)
65await using var writer = new HttpResponseStreamWriter(httpContext.Response.Body, Encoding.UTF8, defaultBufferSize, ArrayPool<byte>.Shared, ArrayPool<char>.Shared);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
TempData\CookieTempDataProvider.cs (2)
64: (rentedDecodeBuffer = ArrayPool<byte>.Shared.Rent(maxDecodedSize)); 100ArrayPool<byte>.Shared.Return(rentedDecodeBuffer);
Microsoft.AspNetCore.Components.Forms (1)
src\aspnetcore\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)
308: (seenComponentIdsStorage = ArrayPool<int>.Shared.Rent(operations.Length)).AsSpan(0, operations.Length); 362ArrayPool<int>.Shared.Return(seenComponentIdsStorage);
ComponentHub.cs (2)
543var buffer = ArrayPool<byte>.Shared.Rent(32 * 1024); 555ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
49_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 30_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 108ArrayPool<T>.Shared.Return(_rentedBuffer); 194_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 202ArrayPool<T>.Shared.Return(oldBuffer);
src\aspnetcore\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\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (2)
1146char[] charArray = ArrayPool<char>.Shared.Rent(maxCharLength); 1172ArrayPool<char>.Shared.Return(charArray);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (2)
1354var buffer = ArrayPool<byte>.Shared.Rent((int)sourceBytesToCopy); 1365ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Components.Web (1)
src\aspnetcore\src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (1)
13private static readonly ArrayPool<char> s_arrayPool = ArrayPool<char>.Shared;
Microsoft.AspNetCore.Components.WebAssembly (3)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
49_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\aspnetcore\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\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
49_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
src\aspnetcore\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 (27)
Cng\CbcAuthenticatedEncryptor.cs (4)
200: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 213ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true); 397: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 418ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true);
Cng\CngGcmAuthenticatedEncryptor.cs (4)
167: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 180ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true); 316: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 337ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true);
KeyManagement\KeyRingBasedDataProtector.cs (2)
377Span<int> purposeLengthsPool = targetLength <= 32 ? stackalloc int[targetLength] : (lease = ArrayPool<int>.Shared.Rent(targetLength)).AsSpan(0, targetLength); 413ArrayPool<int>.Shared.Return(lease);
Managed\AesGcmAuthenticatedEncryptor.cs (4)
170: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 183ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true); 202: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 222ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true);
Managed\ManagedAuthenticatedEncryptor.cs (4)
304: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 318ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true); 487: (rentedBuffer = ArrayPool<byte>.Shared.Rent(outputSize)); 500ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 30_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 108ArrayPool<T>.Shared.Return(_rentedBuffer); 194_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 202ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (9)
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 30_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 108ArrayPool<T>.Shared.Return(_rentedBuffer); 194_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 202ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Logging\HttpLoggingRedactionInterceptor.cs (1)
108var routeParams = ArrayPool<HttpRouteParameter>.Shared.Rent(routeSegments.ParameterCount);
Microsoft.AspNetCore.Http (2)
src\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Http.Abstractions (3)
src\aspnetcore\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 (3)
src\aspnetcore\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)
126private static readonly MethodInfo ArrayPoolSharedReturnMethod = typeof(ArrayPool<char>).GetMethod(nameof(ArrayPool<char>.Shared.Return))!; 2243Expression.Property(null, typeof(ArrayPool<char>).GetProperty(nameof(ArrayPool<char>.Shared))!), 2312buffer = ArrayPool<char>.Shared.Rent(maxKeyBufferSize);
src\aspnetcore\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\aspnetcore\src\Components\Endpoints\src\FormMapping\PrefixResolver.cs (2)
17_sortedKeys = ArrayPool<FormKey>.Shared.Rent(count); 41ArrayPool<FormKey>.Shared.Return(_sortedKeys);
src\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\aspnetcore\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\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (2)
36var buffer = ArrayPool<byte>.Shared.Rent(bufferSize); 79ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.HttpLogging (13)
BufferingStream.cs (1)
169newSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(GetSegmentSize(sizeHint)));
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (1)
73ArrayPool<byte>.Shared.Return(poolArray);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\aspnetcore\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.Identity (5)
Passkeys\BufferSourceJsonConverter.cs (5)
49(pooledArray = ArrayPool<byte>.Shared.Rent(utf8Unescaped.Length)); 58ArrayPool<byte>.Shared.Return(pooledArray); 69ArrayPool<byte>.Shared.Return(pooledArray); 82(pooledArray = ArrayPool<byte>.Shared.Rent(encodedLength)); 93ArrayPool<byte>.Shared.Return(pooledArray);
Microsoft.AspNetCore.Mvc.Core (2)
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (2)
232services.TryAddSingleton(ArrayPool<byte>.Shared); 233services.TryAddSingleton(ArrayPool<char>.Shared);
Microsoft.AspNetCore.Mvc.ViewFeatures (6)
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensions.cs (1)
208services.TryAddSingleton(ArrayPool<ViewBufferValue>.Shared);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (5)
19_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 30_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 108ArrayPool<T>.Shared.Return(_rentedBuffer); 194_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 202ArrayPool<T>.Shared.Return(oldBuffer);
Microsoft.AspNetCore.OpenApi (3)
src\aspnetcore\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.StackExchangeRedis (2)
RedisOutputCacheStore.cs (2)
257leased = ArrayPool<byte>.Shared.Rent(len); 266ArrayPool<byte>.Shared.Return(leased);
Microsoft.AspNetCore.Owin (2)
WebSockets\OwinWebSocketAdapter.cs (2)
138var buffer = ArrayPool<byte>.Shared.Rent(_rentedBufferSize); 149ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Razor.Utilities.Shared (15)
PooledArrayBufferWriter`1.cs (5)
26_rentedBuffer = ArrayPool<T>.Shared.Rent(MinimumBufferSize); 34_rentedBuffer = ArrayPool<T>.Shared.Rent(initialCapacity); 102ArrayPool<T>.Shared.Return(_rentedBuffer); 180_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 188ArrayPool<T>.Shared.Return(oldBuffer);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\MemoryBuilder`1.cs (4)
30_arrayFromPool = ArrayPool<T>.Shared.Rent(initialCapacity); 42ArrayPool<T>.Shared.Return(toReturn, _clearArray); 161var newArray = ArrayPool<T>.Shared.Rent(nextCapacity); 170ArrayPool<T>.Shared.Return(toReturn, _clearArray);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledArray`1.cs (1)
17/// Returns the array that was rented from <see cref="ArrayPool{T}.Shared"/>.
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\Utilities\SortKey`1.cs (1)
12=> ArrayPool<SortKey<T>>.Shared.GetPooledArray(minimumLength);
Utilities\Hashing\NonCryptographicHashAlgorithm.cs (4)
114byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 128ArrayPool<byte>.Shared.Return(buffer); 159byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 177ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.Server.Kestrel.Core (25)
Internal\Http\Http1Connection.cs (2)
705: (rentedBuffer = ArrayPool<byte>.Shared.Rent(absolutePath.Length)); 721ArrayPool<byte>.Shared.Return(rentedBuffer);
Internal\Http\Http1OutputProducer.cs (3)
427ArrayPool<byte>.Shared.Return(_fakeMemory); 690ArrayPool<byte>.Shared.Return(_fakeMemory); 709return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Http\HttpParser.cs (2)
222Span<byte> headerSpan = length <= 256 ? stackalloc byte[256] : array = ArrayPool<byte>.Shared.Rent(length); 256ArrayPool<byte>.Shared.Return(array);
Internal\Http2\Http2FrameWriter.cs (5)
659largeHeaderBuffer = ArrayPool<byte>.Shared.Rent(_headersEncodingLargeBufferSize); 670ArrayPool<byte>.Shared.Return(largeHeaderBuffer); 688ArrayPool<byte>.Shared.Return(largeHeaderBuffer); 691largeHeaderBuffer = ArrayPool<byte>.Shared.Rent(_headersEncodingLargeBufferSize); 702ArrayPool<byte>.Shared.Return(largeHeaderBuffer);
Internal\Http2\Http2OutputProducer.cs (3)
240ArrayPool<byte>.Shared.Return(_fakeMemory); 680ArrayPool<byte>.Shared.Return(_fakeMemory); 699return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Http3\Http3OutputProducer.cs (3)
86ArrayPool<byte>.Shared.Return(_fakeMemory); 247ArrayPool<byte>.Shared.Return(_fakeMemory); 266return _fakeMemory = ArrayPool<byte>.Shared.Rent(minSize);
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (1)
367newSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(minSize));
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (1)
73ArrayPool<byte>.Shared.Return(poolArray);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (4)
44ArrayPool<T>.Shared.Return(_rentedBuffer, clearArray: true); 132_rentedBuffer = ArrayPool<T>.Shared.Rent(rentedInitialSize); 155_rentedBuffer = ArrayPool<T>.Shared.Rent(newSize); 162ArrayPool<T>.Shared.Return(oldBuffer);
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackDecoder.cs (1)
128private static ArrayPool<byte> Pool => ArrayPool<byte>.Shared;
Microsoft.AspNetCore.Server.Kestrel.Transport.DirectTls (5)
TlsEventPump.cs (3)
1289rented = ArrayPool<byte>.Shared.Rent(helloLength); 1294ArrayPool<byte>.Shared.Return(rented); 1306ArrayPool<byte>.Shared.Return(rented);
UserCallbacks\ResolveTlsContextCallback.cs (2)
30/// no listener, or nothing was captured); this work item returns it to <see cref="ArrayPool{T}.Shared"/> 77ArrayPool<byte>.Shared.Return(buffer);
Microsoft.AspNetCore.SignalR.Common (3)
src\aspnetcore\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.Core (2)
Internal\Utf8HashLookup.cs (2)
87(pooled = ArrayPool<char>.Shared.Rent(count)); 92ArrayPool<char>.Shared.Return(pooled);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (3)
src\aspnetcore\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\aspnetcore\src\SignalR\common\Shared\JsonUtils.cs (1)
200internal static readonly JsonArrayPool<T> Shared = new JsonArrayPool<T>(ArrayPool<T>.Shared);
src\aspnetcore\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\aspnetcore\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\aspnetcore\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\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
63ArrayPool<T>.Shared.Return(toReturn); 91T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 98ArrayPool<T>.Shared.Return(toReturn);
src\aspnetcore\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 (20)
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)
StreamHelperExtensions.cs (2)
26return stream.DrainAsync(ArrayPool<byte>.Shared, null, cancellationToken); 41return stream.DrainAsync(ArrayPool<byte>.Shared, limit, cancellationToken);
Microsoft.Build (4)
Logging\BinaryLogger\Postprocessing\StreamExtensions.cs (2)
31byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 32using 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.Framework (11)
BackEnd\InterningBinaryReader.cs (2)
144resultBuffer ??= ArrayPool<char>.Shared.Rent(stringLength); // Actual string length in chars may be smaller. 165ArrayPool<char>.Shared.Return(resultBuffer);
Utilities\BufferScope.cs (5)
25_array = ArrayPool<T>.Shared.Rent(minimumLength); 67_array = ArrayPool<T>.Shared.Rent(minimumLength); 98T[] newArray = ArrayPool<T>.Shared.Rent(capacity); 106ArrayPool<T>.Shared.Return(_array, clearArray: TypeInfo<T>.IsReferenceOrContainsReferences()); 181ArrayPool<T>.Shared.Return(_array, clearArray: TypeInfo<T>.IsReferenceOrContainsReferences());
Utilities\ValueStringBuilder.cs (4)
56_arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(initialCapacity * sizeof(char)); 420byte[] poolArray = ArrayPool<byte>.Shared.Rent(newCapacity * sizeof(char)); 429ArrayPool<byte>.Shared.Return(toReturn); 452ArrayPool<byte>.Shared.Return(toReturn);
Microsoft.Build.Tasks.Core (4)
Hash.cs (4)
76shaBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(ShaBufferSize); 77itemSpecChunkByteBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(s_encoding.GetMaxByteCount(MaxInputChunkLength)); 115System.Buffers.ArrayPool<byte>.Shared.Return(shaBuffer); 119System.Buffers.ArrayPool<byte>.Shared.Return(itemSpecChunkByteBuffer);
Microsoft.CodeAnalysis (4)
Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
Microsoft.CodeAnalysis.Analyzers (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Microsoft.CodeAnalysis.CodeStyle (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Microsoft.CodeAnalysis.CSharp (4)
Syntax\SyntaxTreeDiagnosticEnumerator.cs (4)
133private NodeIteration[] _stack = ArrayPool<NodeIteration>.Shared.Rent(capacity); 137=> ArrayPool<NodeIteration>.Shared.Return(_stack, clearArray: true); 166var tmp = ArrayPool<NodeIteration>.Shared.Rent(_stack.Length * 2); 168ArrayPool<NodeIteration>.Shared.Return(_stack, clearArray: true);
Microsoft.CodeAnalysis.Razor.Compiler (14)
Language\CodeGeneration\CodeWriter.cs (2)
67ArrayPool<ReadOnlyMemory<char>>.Shared.Return(page, clearArray: true); 85lastPage = ArrayPool<ReadOnlyMemory<char>>.Shared.Rent(MinimumPageSize);
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (1)
577using var _ = ArrayPool<SyntaxTokenList>.Shared.GetPooledArraySpan(5, out var tokenLists);
Language\Intermediate\IntermediateNodeCollection.InlineList.cs (6)
79_items = ArrayPool<IntermediateNode>.Shared.Rent(4); 107_items = ArrayPool<IntermediateNode>.Shared.Rent(4); 150ArrayPool<IntermediateNode>.Shared.Return(_items, clearArray: true); 171ArrayPool<IntermediateNode>.Shared.Return(_items, clearArray: false); 218var newArray = ArrayPool<IntermediateNode>.Shared.Rent(newCapacity); 221ArrayPool<IntermediateNode>.Shared.Return(oldArray, clearArray: true);
Language\TagHelperCollection_Factories.cs (3)
195var pooledArray = ArrayPool<TagHelperCollection>.Shared.GetPooledArraySpan( 278using var _ = ArrayPool<TagHelperCollection>.Shared.GetPooledArraySpan( 333using var _ = ArrayPool<TagHelperCollection>.Shared.GetPooledArraySpan(
Language\TagHelperDiscoverer.cs (2)
79using var _ = ArrayPool<TagHelperProducer>.Shared.GetPooledArraySpan( 192using var _ = ArrayPool<TagHelperProducer>.Shared.GetPooledArraySpan(
Microsoft.CodeAnalysis.ResxSourceGenerator (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Microsoft.CodeAnalysis.Workspaces (10)
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.NavigateToSearchInfo.cs (2)
187? ArrayPool<char>.Shared.Rent(maxNameLength) 207ArrayPool<char>.Shared.Return(rentedCharArray);
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Utilities\Deque.cs (2)
100var newArray = ArrayPool<T>.Shared.Rent(newCapacity); 123ArrayPool<T>.Shared.Return(_array, clearArray: MustClearReferences());
Microsoft.DotNet.Build.Tasks.FileCatalog (2)
CatalogEntry.cs (2)
40byte[] buffer = ArrayPool<byte>.Shared.Rent(81920); 52ArrayPool<byte>.Shared.Return(buffer);
Microsoft.DotNet.Cli.Utils (5)
BufferScope.cs (5)
29_array = ArrayPool<T>.Shared.Rent(minimumLength); 71_array = ArrayPool<T>.Shared.Rent(minimumLength); 102T[] newArray = ArrayPool<T>.Shared.Rent(capacity); 110ArrayPool<T>.Shared.Return(_array, clearArray: TypeInfo<T>.IsReferenceOrContainsReferences()); 185ArrayPool<T>.Shared.Return(_array, clearArray: TypeInfo<T>.IsReferenceOrContainsReferences());
Microsoft.DotNet.HotReload.Watch (18)
src\sdk\src\Dotnet.Watch\HotReloadAgent.PipeRpc\StreamExtensions.cs (16)
28var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 36ArrayPool<byte>.Shared.Return(buffer); 43var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 51ArrayPool<byte>.Shared.Return(buffer); 67var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 80ArrayPool<byte>.Shared.Return(buffer); 114var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 122ArrayPool<byte>.Shared.Return(buffer); 129var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 137ArrayPool<byte>.Shared.Return(buffer); 145var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 154ArrayPool<byte>.Shared.Return(buffer); 186var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 198ArrayPool<byte>.Shared.Return(buffer); 217var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 225ArrayPool<byte>.Shared.Return(buffer);
src\sdk\src\Dotnet.Watch\HotReloadClient\WebSocketClientTransport.cs (2)
200var buffer = ArrayPool<byte>.Shared.Rent(4096); 225ArrayPool<byte>.Shared.Return(buffer);
Microsoft.DotNet.TemplateLocator (4)
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.SystemTextJson.cs (4)
53buffer = ArrayPool<byte>.Shared.Rent(segmentSize); 73ArrayPool<byte>.Shared.Return(buffer); 89var newBuffer = ArrayPool<byte>.Shared.Rent(newSegmentSize); 100ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Extensions.AI (6)
ChatCompletion\ChatResponse{T}.cs (2)
96var buffer = ArrayPool<byte>.Shared.Rent(utf8ByteLength); 106ArrayPool<byte>.Shared.Return(buffer);
ChatCompletion\DistributedCachingChatClient.cs (2)
142object?[] arr = ArrayPool<object?>.Shared.Rent(length); 156ArrayPool<object?>.Shared.Return(arr);
Embeddings\DistributedCachingEmbeddingGenerator.cs (2)
118object?[] arr = ArrayPool<object?>.Shared.Rent(length); 130ArrayPool<object?>.Shared.Return(arr);
Microsoft.Extensions.AI.Abstractions (8)
Embeddings\BinaryEmbedding.cs (4)
65tmpArray = ArrayPool<byte>.Shared.Rent(length); 83ArrayPool<byte>.Shared.Return(tmpArray); 98byte[] tmpArray = ArrayPool<byte>.Shared.Rent(length); 108ArrayPool<byte>.Shared.Return(tmpArray);
Functions\AIFunctionFactory.cs (4)
1383_buffer = ArrayPool<byte>.Shared.Rent(initialCapacity); 1447ArrayPool<byte>.Shared.Return(_buffer); 1462byte[] newBuffer = ArrayPool<byte>.Shared.Rent(newCapacity); 1465ArrayPool<byte>.Shared.Return(_buffer);
Microsoft.Extensions.Caching.Hybrid (23)
Internal\BufferChunk.cs (1)
80ArrayPool<byte>.Shared.Return(OversizedArray!);
Internal\DefaultHybridCache.L2.cs (5)
112byte[] oversized = ArrayPool<byte>.Shared.Rent(sizeof(long)); 119ArrayPool<byte>.Shared.Return(oversized); 130ArrayPool<byte>.Shared.Return(oversized); 225byte[] oversized = ArrayPool<byte>.Shared.Rent(maxLength); 232ArrayPool<byte>.Shared.Return(oversized);
Internal\DefaultHybridCache.StampedeStateT.cs (4)
549Span<byte> byteBuffer = maxBytes <= 128 ? stackalloc byte[128] : (leasedBytes = ArrayPool<byte>.Shared.Rent(maxBytes)); 550Span<char> charBuffer = maxChars <= 128 ? stackalloc char[128] : (leasedChars = ArrayPool<char>.Shared.Rent(maxChars)); 590ArrayPool<char>.Shared.Return(leasedChars); 591ArrayPool<byte>.Shared.Return(leasedBytes);
Internal\HybridCachePayload.cs (6)
278string[] newBuffer = ArrayPool<string>.Shared.Rent(Math.Max(4, pendingTagsCount * 2)); 280ArrayPool<string>.Shared.Return(pendingTagBuffer); 327ArrayPool<char>.Shared.Return(scratch); 328ArrayPool<string>.Shared.Return(pendingTagBuffer); 346ArrayPool<char>.Shared.Return(scratch); 347scratch = ArrayPool<char>.Shared.Rent(maxChars);
Internal\RecyclableArrayBufferWriter.cs (3)
76ArrayPool<T>.Shared.Return(tmp); 193_buffer = ArrayPool<T>.Shared.Rent(newSize); 197ArrayPool<T>.Shared.Return(oldArray);
Internal\TagSet.cs (4)
137string[] oversized = ArrayPool<string>.Shared.Rent(8); 145string[] bigger = ArrayPool<string>.Shared.Rent(count * 2); 147ArrayPool<string>.Shared.Return(oversized); 162ArrayPool<string>.Shared.Return(oversized);
Microsoft.Extensions.Caching.Hybrid.Tests (12)
BufferReleaseTests.cs (4)
132var arr = ArrayPool<byte>.Shared.Rent(HybridCachePayload.GetMaxBytes(key, TagSet.Empty, writer.CommittedBytes)); 135ArrayPool<byte>.Shared.Return(arr); 195var arr = ArrayPool<byte>.Shared.Rent(HybridCachePayload.GetMaxBytes(key, TagSet.Empty, writer.CommittedBytes)); 198ArrayPool<byte>.Shared.Return(arr);
PayloadTests.cs (8)
49var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 79var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 113var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 143var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 179var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 233var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 260var oversized = ArrayPool<byte>.Shared.Rent(maxLen); 346var oversized = ArrayPool<byte>.Shared.Rent(maxLen);
Microsoft.Extensions.Caching.SqlServer (4)
DatabaseOperations.cs (2)
336lease ??= ArrayPool<byte>.Shared.Rent(DefaultPageSize); 357ArrayPool<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)
141lease = ArrayPool<byte>.Shared.Rent(length); 150ArrayPool<byte>.Shared.Return(lease);
Microsoft.Extensions.Compliance.Abstractions (2)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (2)
57_rentedBuffer = ArrayPool<T>.Shared.Rent(length); 81ArrayPool<T>.Shared.Return(_rentedBuffer);
Microsoft.Extensions.Configuration.Binder.SourceGeneration (3)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
Microsoft.Extensions.Configuration.EnvironmentVariables (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
Microsoft.Extensions.DataIngestion (4)
Chunkers\ValueStringBuilder.cs (4)
33_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
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.Diagnostics.ResourceMonitoring (2)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (2)
57_rentedBuffer = ArrayPool<T>.Shared.Rent(length); 81ArrayPool<T>.Shared.Return(_rentedBuffer);
Microsoft.Extensions.DotNetDeltaApplier (18)
src\sdk\src\Dotnet.Watch\HotReloadAgent.Host\WebSocketTransport.cs (2)
98var buffer = ArrayPool<byte>.Shared.Rent(4096); 118ArrayPool<byte>.Shared.Return(buffer);
src\sdk\src\Dotnet.Watch\HotReloadAgent.PipeRpc\StreamExtensions.cs (16)
28var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 36ArrayPool<byte>.Shared.Return(buffer); 43var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 51ArrayPool<byte>.Shared.Return(buffer); 67var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 80ArrayPool<byte>.Shared.Return(buffer); 114var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 122ArrayPool<byte>.Shared.Return(buffer); 129var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 137ArrayPool<byte>.Shared.Return(buffer); 145var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 154ArrayPool<byte>.Shared.Return(buffer); 186var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 198ArrayPool<byte>.Shared.Return(buffer); 217var buffer = ArrayPool<byte>.Shared.Rent(minimumLength: size); 225ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Extensions.Http.Diagnostics (4)
Logging\Internal\HttpRequestBodyReader.cs (2)
86var buffer = ArrayPool<byte>.Shared.Rent(readLimit); 98ArrayPool<byte>.Shared.Return(buffer);
Logging\Internal\HttpRequestReader.cs (1)
264var routeParams = ArrayPool<HttpRouteParameter>.Shared.Rent(routeSegments.ParameterCount);
Logging\Internal\LogRecord.cs (1)
87ArrayPool<HttpRouteParameter>.Shared.Return(PathParameters);
Microsoft.Extensions.Logging.Abstractions (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
Microsoft.Extensions.Logging.Console (10)
JsonConsoleFormatter.cs (2)
105var logMessageBuffer = ArrayPool<char>.Shared.Rent(Encoding.UTF8.GetMaxCharCount(messageBytes.Length)); 113ArrayPool<char>.Shared.Return(logMessageBuffer);
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
Microsoft.Extensions.Logging.Generators (3)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
Microsoft.Extensions.Options.Contextual (2)
Internal\ContextualOptionsFactory.cs (2)
77var loadTasks = ArrayPool<ValueTask<IConfigureContextualOptions<TOptions>>>.Shared.Rent(_loaders.Length); 117ArrayPool<ValueTask<IConfigureContextualOptions<TOptions>>>.Shared.Return(loadTasks);
Microsoft.Extensions.ServiceDiscovery.Dns (13)
Resolver\DnsDataReader.cs (1)
127ArrayPool<byte>.Shared.Return(MessageBuffer.Array);
Resolver\DnsResolver.cs (10)
704byte[] buffer = ArrayPool<byte>.Shared.Rent(2048); 727ArrayPool<byte>.Shared.Return(buffer); 734var buffer = ArrayPool<byte>.Shared.Rent(512); 776ArrayPool<byte>.Shared.Return(buffer); 783var buffer = ArrayPool<byte>.Shared.Rent(8 * 1024); 815var largerBuffer = ArrayPool<byte>.Shared.Rent(responseLength + 2); 817ArrayPool<byte>.Shared.Return(buffer); 840ArrayPool<byte>.Shared.Return(buffer); 910byte[] buffer = ArrayPool<byte>.Shared.Rent(256); 941ArrayPool<byte>.Shared.Return(buffer);
Resolver\DnsResponse.cs (1)
34ArrayPool<byte>.Shared.Return(RawMessageBytes.Array);
Resolver\EncodedDomainName.cs (1)
77ArrayPool<byte>.Shared.Return(_pooledBuffer);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (8)
Resolver\LoopbackDnsServer.cs (8)
54byte[] buffer = ArrayPool<byte>.Shared.Rent(512); 66ArrayPool<byte>.Shared.Return(buffer); 86byte[] buffer = ArrayPool<byte>.Shared.Rent(8 * 1024); 109ArrayPool<byte>.Shared.Return(buffer); 165byte[] buffer = ArrayPool<byte>.Shared.Rent(512); 178ArrayPool<byte>.Shared.Return(buffer); 209byte[] buffer = ArrayPool<byte>.Shared.Rent(512); 217ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (4)
Fuzzers\EncodedDomainNameFuzzer.cs (2)
10byte[] buffer = ArrayPool<byte>.Shared.Rent(data.Length); 29ArrayPool<byte>.Shared.Return(buffer);
Fuzzers\WriteDomainNameRoundTripFuzzer.cs (2)
16byte[] buffer = ArrayPool<byte>.Shared.Rent(data.Length * 2); 45ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Extensions.Telemetry (7)
Logging\JustInTimeRedactor.cs (5)
131a = ArrayPool<char>.Shared.Rent(maxLenToRedact); 157var t = ArrayPool<char>.Shared.Rent(redactedLen); 160ArrayPool<char>.Shared.Return(t); 167ArrayPool<char>.Shared.Return(a); 177ArrayPool<char>.Shared.Return(a);
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (2)
57_rentedBuffer = ArrayPool<T>.Shared.Rent(length); 81ArrayPool<T>.Shared.Return(_rentedBuffer);
Microsoft.JSInterop (3)
Infrastructure\DotNetDispatcher.cs (2)
223var buffer = ArrayPool<byte>.Shared.Rent(count); 283ArrayPool<byte>.Shared.Return(buffer);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
49_arrayPool = arrayPool ?? ArrayPool<T>.Shared;
Microsoft.ML.Core (2)
Utilities\Stream.cs (2)
698byte[] rentedArray = ArrayPool<byte>.Shared.Rent(maxChunkSizeInBytes); 723ArrayPool<byte>.Shared.Return(rentedArray);
Microsoft.ML.ImageAnalytics (1)
ImageLoader.cs (1)
333var bufferPool = ArrayPool<byte>.Shared;
Microsoft.ML.Tokenizers (194)
Model\BPETokenizer.cs (14)
840byte[] bytes = ArrayPool<byte>.Shared.Rent(BufferLength << 1); 874ArrayPool<byte>.Shared.Return(bytes); 1326tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 1329mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 1368ArrayPool<char>.Shared.Return(tokenBuffer); 1370ArrayPool<int>.Shared.Return(mappingBuffer); 1439tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 1442mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 1488ArrayPool<char>.Shared.Return(tokenBuffer); 1490ArrayPool<int>.Shared.Return(mappingBuffer); 1519tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 1522mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 1570ArrayPool<char>.Shared.Return(tokenBuffer); 1572ArrayPool<int>.Shared.Return(mappingBuffer);
Model\CodeGenTokenizer.cs (24)
347mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 411ArrayPool<char>.Shared.Return(mutatedInputText); 455tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 458mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 477ArrayPool<char>.Shared.Return(tokenBuffer); 479ArrayPool<int>.Shared.Return(mappingBuffer); 604mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 662ArrayPool<char>.Shared.Return(mutatedInputText); 823mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 874ArrayPool<char>.Shared.Return(mutatedInputText); 960mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1); 1008ArrayPool<char>.Shared.Return(mutatedInputText); 1138tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 1141mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 1161ArrayPool<char>.Shared.Return(tokenBuffer); 1163ArrayPool<int>.Shared.Return(mappingBuffer); 1202tokenBuffer = ArrayPool<char>.Shared.Rent(destinationMaxSize); 1205mappingBuffer = ArrayPool<int>.Shared.Rent(destinationMaxSize); 1225ArrayPool<char>.Shared.Return(tokenBuffer); 1227ArrayPool<int>.Shared.Return(mappingBuffer); 1253byte[] bytes = ArrayPool<byte>.Shared.Rent(128); 1318ArrayPool<byte>.Shared.Return(bytes); 1613BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 1677ArrayPool<BpeSymbol>.Shared.Return(symbols);
Model\EnglishRobertaTokenizer.cs (22)
283char[] buffer = ArrayPool<char>.Shared.Rent(v.Length); 296ArrayPool<char>.Shared.Return(buffer); 363char[] token = ArrayPool<char>.Shared.Rent(text.Length); 364int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 381ArrayPool<char>.Shared.Return(token); 382ArrayPool<int>.Shared.Return(indexMapping); 388ArrayPool<char>.Shared.Return(token); 389ArrayPool<int>.Shared.Return(indexMapping); 395ArrayPool<char>.Shared.Return(token); 396ArrayPool<int>.Shared.Return(indexMapping); 675char[] token = ArrayPool<char>.Shared.Rent(text.Length); 676int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 693ArrayPool<char>.Shared.Return(token); 694ArrayPool<int>.Shared.Return(indexMapping); 701ArrayPool<char>.Shared.Return(token); 702ArrayPool<int>.Shared.Return(indexMapping); 720char[] token = ArrayPool<char>.Shared.Rent(text.Length); 721int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length); 738ArrayPool<char>.Shared.Return(token); 739ArrayPool<int>.Shared.Return(indexMapping); 746ArrayPool<char>.Shared.Return(token); 747ArrayPool<int>.Shared.Return(indexMapping);
Model\SentencePieceBaseModel.cs (8)
309ArrayPool<byte>.Shared.Return(bytesPoolArray); 314ArrayPool<char>.Shared.Return(charPoolArray); 326charPoolArray ??= ArrayPool<char>.Shared.Rent(Math.Max(len, ApproximatedMaxEncodedBytesCount >> 1)); 348bytesPoolArray ??= ArrayPool<byte>.Shared.Rent(ApproximatedMaxEncodedBytesCount); 610ArrayPool<byte>.Shared.Return(bytesPoolArray); 615ArrayPool<char>.Shared.Return(charPoolArray); 664charPoolArray ??= ArrayPool<char>.Shared.Rent(Math.Max(len, ApproximatedMaxEncodedBytesCount >> 1)); 702bytesPoolArray ??= ArrayPool<byte>.Shared.Rent(ApproximatedMaxEncodedBytesCount);
Model\SentencePieceBpeModel.cs (18)
152BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 199ArrayPool<BpeSymbol>.Shared.Return(symbols); 231arrayPoolArray = ArrayPool<byte>.Shared.Rent(len); 252ArrayPool<byte>.Shared.Return(arrayPoolArray); 435BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 464ArrayPool<BpeSymbol>.Shared.Return(symbols); 478ArrayPool<BpeSymbol>.Shared.Return(symbols); 491ArrayPool<BpeSymbol>.Shared.Return(symbols); 531arrayPoolArray = ArrayPool<byte>.Shared.Rent(len); 556ArrayPool<byte>.Shared.Return(arrayPoolArray); 703BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 756ArrayPool<BpeSymbol>.Shared.Return(symbols); 794arrayPoolArray = ArrayPool<byte>.Shared.Rent(len); 815ArrayPool<byte>.Shared.Return(arrayPoolArray); 972BpeSymbol[] symbols = ArrayPool<BpeSymbol>.Shared.Rent(text.Length); 1032ArrayPool<BpeSymbol>.Shared.Return(symbols); 1070arrayPoolArray = ArrayPool<byte>.Shared.Rent(len); 1091ArrayPool<byte>.Shared.Return(arrayPoolArray);
Model\SentencePieceUnigramModel.cs (40)
387int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 390char[] normalizedString = ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 401ArrayPool<char>.Shared.Return(normalizedString); 402ArrayPool<int>.Shared.Return(buffer); 424char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1); 426ArrayPool<char>.Shared.Return(normalizedString); 441char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1); 443ArrayPool<char>.Shared.Return(normalizedString); 588ArrayPool<byte>.Shared.Return(normalizedArrayPool); 620BestPathNode[] bestPathEndsAt = ArrayPool<BestPathNode>.Shared.Rent(normalizationSpan.Length + 1); 680ArrayPool<BestPathNode>.Shared.Return(bestPathEndsAt); 683ArrayPool<byte>.Shared.Return(normalizedArrayPool); 862int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 865char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 891ArrayPool<char>.Shared.Return(normalizedString); 894ArrayPool<int>.Shared.Return(buffer); 913ArrayPool<byte>.Shared.Return(normalizedArrayPool); 1071BestPathNode[] bestPathEndsAt = ArrayPool<BestPathNode>.Shared.Rent(normalizationSpan.Length + 1); 1094unknownTokensTracking = ArrayPool<(int IdsIndex, int Utf8Index, int Utf8Length)>.Shared.Rent(10); 1107ArrayPool<BestPathNode>.Shared.Return(bestPathEndsAt); 1143ArrayPool<byte>.Shared.Return(normalizedArrayPool); 1217ArrayPool<(int IdsIndex, int Utf8Index, int Utf8Length)>.Shared.Return(unknownTokensTracking); 1222ArrayPool<byte>.Shared.Return(normalizedArrayPool); 1262int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 1265char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 1291ArrayPool<char>.Shared.Return(normalizedString); 1294ArrayPool<int>.Shared.Return(buffer); 1412BestPathNode[] bestPathEndsAt = ArrayPool<BestPathNode>.Shared.Rent(normalizationSpan.Length + 1); 1418(int Id, int UtfStartOffset, int Utf8Length)[] ids = ArrayPool<(int Id, int UtfStartOffset, int Utf8Length)>.Shared.Rent(bestPathEndsAt.Length); 1438ArrayPool<BestPathNode>.Shared.Return(bestPathEndsAt); 1451ArrayPool<(int Id, int UtfStartOffset, int Utf8Length)>.Shared.Return(ids); 1455ArrayPool<byte>.Shared.Return(normalizedArrayPool); 1493ArrayPool<(int Id, int UtfStartOffset, int Utf8Length)>.Shared.Return(ids); 1502ArrayPool<byte>.Shared.Return(normalizedArrayPool); 1539int[] buffer = ArrayPool<int>.Shared.Rent(textToEncode.Length * 3); 1542char[]? normalizedString = maxTokenCount == int.MaxValue ? null : ArrayPool<char>.Shared.Rent(textToEncode.Length + 2); 1568ArrayPool<int>.Shared.Return(buffer); 1673BestPathNode[] bestPathEndsAt = ArrayPool<BestPathNode>.Shared.Rent(normalizationSpan.Length + 1); 1726ArrayPool<BestPathNode>.Shared.Return(bestPathEndsAt); 1729ArrayPool<byte>.Shared.Return(normalizedArrayPool);
Model\TiktokenTokenizer.cs (19)
324byte[] arrayPoolArray = arrayPoolArray = ArrayPool<byte>.Shared.Rent(utf8Length); 326Span<int> indexMappingSpan = utf8Length + 1 <= 128 ? stackalloc int[128] : (indexMappingArray = ArrayPool<int>.Shared.Rent(utf8Length + 1)); 332ArrayPool<byte>.Shared.Return(arrayPoolArray); 335ArrayPool<int>.Shared.Return(indexMappingArray); 441byte[] arrayPoolArray = arrayPoolArray = ArrayPool<byte>.Shared.Rent(utf8Length); 443Span<int> indexMappingSpan = utf8Length + 1 <= 128 ? stackalloc int[128] : (indexMappingArray = ArrayPool<int>.Shared.Rent(utf8Length + 1)); 449ArrayPool<byte>.Shared.Return(arrayPoolArray); 452ArrayPool<int>.Shared.Return(indexMappingArray); 606byte[] arrayPoolArray = arrayPoolArray = ArrayPool<byte>.Shared.Rent(utf8Length); 608Span<int> indexMappingSpan = utf8Length + 1 <= 128 ? stackalloc int[128] : (indexMappingArray = ArrayPool<int>.Shared.Rent(utf8Length + 1)); 614ArrayPool<byte>.Shared.Return(arrayPoolArray); 617ArrayPool<int>.Shared.Return(indexMappingArray); 732byte[] arrayPoolArray = arrayPoolArray = ArrayPool<byte>.Shared.Rent(utf8Length); 734Span<int> indexMappingSpan = utf8Length + 1 <= 128 ? stackalloc int[128] : (indexMappingArray = ArrayPool<int>.Shared.Rent(utf8Length + 1)); 740ArrayPool<byte>.Shared.Return(arrayPoolArray); 743ArrayPool<int>.Shared.Return(indexMappingArray); 835ArrayPool<byte>.Shared.Return(arrayPoolArray); 841byte[] tmp = ArrayPool<byte>.Shared.Rent(Math.Max(utf8Bytes.Length * 2, requiredCapacity)); 847ArrayPool<byte>.Shared.Return(toReturn);
Model\WordPieceTokenizer.cs (4)
324char[]? arrayPool = maxLength <= 250 ? null : ArrayPool<char>.Shared.Rent(maxLength); 378ArrayPool<char>.Shared.Return(arrayPool); 464char[]? arrayPool = maxLength <= 250 ? null : ArrayPool<char>.Shared.Rent(maxLength); 528ArrayPool<char>.Shared.Return(arrayPool);
Normalizer\BertNormalizer.cs (2)
42char[] buffer = ArrayPool<char>.Shared.Rent(original.Length); 117ArrayPool<char>.Shared.Return(buffer);
Normalizer\LowerCaseNormalizer.cs (2)
45char[] arrayPoolArray = ArrayPool<char>.Shared.Rent(original.Length); 51ArrayPool<char>.Shared.Return(arrayPoolArray);
Normalizer\SentencePieceNormalizer.cs (8)
116byte[] inputArray = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(text.Length)); 117byte[]? poolArray = ArrayPool<byte>.Shared.Rent(Math.Max(64, Encoding.UTF8.GetMaxByteCount(text.Length) * 2)); 127ArrayPool<byte>.Shared.Return(inputArray); 130ArrayPool<byte>.Shared.Return(poolArray); 185buffer = ArrayPool<char>.Shared.Rent(spanLength); 244ArrayPool<char>.Shared.Return(buffer); 401byte[] chainedBytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(chained.Length)); 409ArrayPool<byte>.Shared.Return(chainedBytes);
Normalizer\UpperCaseNormalizer.cs (2)
45char[] arrayPoolArray = ArrayPool<char>.Shared.Rent(original.Length); 51ArrayPool<char>.Shared.Return(arrayPoolArray);
PreTokenizer\CompositePreTokenizer.cs (2)
151char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 156ArrayPool<char>.Shared.Return(buffer);
PreTokenizer\PreTokenizer.cs (2)
136char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 150ArrayPool<char>.Shared.Return(text);
PreTokenizer\RegexPreTokenizer.cs (2)
104char[] buffer = ArrayPool<char>.Shared.Rent(text.Length); 140ArrayPool<char>.Shared.Return(text);
Tokenizer.cs (4)
381char[] destination = ArrayPool<char>.Shared.Rent( 393ArrayPool<char>.Shared.Return(destination); 407ArrayPool<char>.Shared.Return(destination); 408destination = ArrayPool<char>.Shared.Rent((int)newSize);
Utils\BytePairEncoder.cs (6)
36(arrayPoolArray = ArrayPool<(int, int)>.Shared.Rent(requiredLength)); 122ArrayPool<(int, int)>.Shared.Return(arrayPoolArray); 159State[] statePoolArray = ArrayPool<State>.Shared.Rent(stateLength); 248var resultPoolArray = ArrayPool<(int Id, int TokenIndex, int TokenLength)>.Shared.Rent(mergingBytes.Length); 283ArrayPool<State>.Shared.Return(statePoolArray); 286ArrayPool<(int Id, int TokenIndex, int TokenLength)>.Shared.Return(resultPoolArray);
Utils\DoubleArrayTrie.cs (3)
751ArrayPool<byte>.Shared.Return(array); 754array = ArrayPool<byte>.Shared.Rent(encodingLength * 2); 765ArrayPool<byte>.Shared.Return(array);
Utils\Helpers.cs (4)
24T[] tmp = ArrayPool<T>.Shared.Rent(Math.Max(arrayPoolArray.Length * 2, requiredCapacity)); 26ArrayPool<T>.Shared.Return(arrayPoolArray); 34T[] newPoolArray = ArrayPool<T>.Shared.Rent(newSize); 39ArrayPool<T>.Shared.Return(poolArray);
Utils\OrdinalUtf8StringComparer.cs (4)
63bytes1 = ArrayPool<byte>.Shared.Rent(requiredLength1); 69bytes2 = ArrayPool<byte>.Shared.Rent(requiredLength2); 80ArrayPool<byte>.Shared.Return(bytes1); 85ArrayPool<byte>.Shared.Return(bytes2);
Utils\ValueStringBuilder.cs (4)
30_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 405char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 413ArrayPool<char>.Shared.Return(toReturn); 424ArrayPool<char>.Shared.Return(toReturn);
Microsoft.ML.Tokenizers.Tests (11)
src\Microsoft.ML.Tokenizers\Utils\DoubleArrayTrie.cs (3)
751ArrayPool<byte>.Shared.Return(array); 754array = ArrayPool<byte>.Shared.Rent(encodingLength * 2); 765ArrayPool<byte>.Shared.Return(array);
src\Microsoft.ML.Tokenizers\Utils\Helpers.cs (4)
24T[] tmp = ArrayPool<T>.Shared.Rent(Math.Max(arrayPoolArray.Length * 2, requiredCapacity)); 26ArrayPool<T>.Shared.Return(arrayPoolArray); 34T[] newPoolArray = ArrayPool<T>.Shared.Rent(newSize); 39ArrayPool<T>.Shared.Return(poolArray);
src\Microsoft.ML.Tokenizers\Utils\OrdinalUtf8StringComparer.cs (4)
63bytes1 = ArrayPool<byte>.Shared.Rent(requiredLength1); 69bytes2 = ArrayPool<byte>.Shared.Rent(requiredLength2); 80ArrayPool<byte>.Shared.Return(bytes1); 85ArrayPool<byte>.Shared.Return(bytes2);
Microsoft.NET.Build.Tasks (4)
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.SystemTextJson.cs (4)
53buffer = ArrayPool<byte>.Shared.Rent(segmentSize); 73ArrayPool<byte>.Shared.Return(buffer); 89var newBuffer = ArrayPool<byte>.Shared.Rent(newSegmentSize); 100ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Net.Http.Headers (4)
ContentDispositionHeaderValue.cs (4)
551: bufferFromPool = ArrayPool<byte>.Shared.Rent(requiredLength); 566ArrayPool<byte>.Shared.Return(bufferFromPool); 719unescapedBytes = ArrayPool<byte>.Shared.Rent(dataString.Length); 755ArrayPool<byte>.Shared.Return(unescapedBytes);
Microsoft.NET.Sdk.WorkloadManifestReader (4)
WorkloadManifestReader.SystemTextJson.cs (4)
53buffer = ArrayPool<byte>.Shared.Rent(segmentSize); 73ArrayPool<byte>.Shared.Return(buffer); 89var newBuffer = ArrayPool<byte>.Shared.Rent(newSegmentSize); 100ArrayPool<byte>.Shared.Return(buffer);
Microsoft.Private.Windows.Core (16)
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\IO\BinaryReaderExtensions.cs (2)
26byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 35ArrayPool<byte>.Shared.Return(sharedBuffer);
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\IO\StreamExtensions.cs (4)
31byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 45ArrayPool<byte>.Shared.Return(sharedBuffer); 56byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 64ArrayPool<byte>.Shared.Return(sharedBuffer);
System\BufferScope.cs (5)
24_array = ArrayPool<T>.Shared.Rent(minimumLength); 66_array = ArrayPool<T>.Shared.Rent(minimumLength); 88T[] newArray = ArrayPool<T>.Shared.Rent(capacity); 96ArrayPool<T>.Shared.Return(_array); 123ArrayPool<T>.Shared.Return(_array);
System\Text\ValueStringBuilder.cs (5)
27_chars = ArrayPool<char>.Shared.Rent( 41_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 334char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 342ArrayPool<char>.Shared.Return(toReturn); 353ArrayPool<char>.Shared.Return(toReturn);
Microsoft.Win32.Registry (10)
Microsoft\Win32\RegistryKey.cs (10)
863char[]? name = ArrayPool<char>.Shared.Rent(100); 917ArrayPool<char>.Shared.Return(oldName); 918name = ArrayPool<char>.Shared.Rent(checked(oldLength * 2)); 934ArrayPool<char>.Shared.Return(name); 1006span = pooledArray = ArrayPool<byte>.Shared.Rent(65_000); 1047ArrayPool<byte>.Shared.Return(toReturn); 1056span = pooledArray = ArrayPool<byte>.Shared.Rent(dataLength); 1110byte[] newPooled = ArrayPool<byte>.Shared.Rent(dataLength + 1); 1116ArrayPool<byte>.Shared.Return(toReturn); 1194ArrayPool<byte>.Shared.Return(pooledArray);
NuGet.Common (2)
MsBuildStringUtility.cs (2)
112logCodes ??= ArrayPool<NuGetLogCode>.Shared.Rent(split.Length); 124ArrayPool<NuGetLogCode>.Shared.Return(logCodes);
NuGet.Packaging (6)
Signing\Archive\SignedPackageArchiveIOUtility.cs (6)
56byte[] buffer = ArrayPool<byte>.Shared.Rent(_bufferSize); 68ArrayPool<byte>.Shared.Return(buffer); 96byte[] buffer = ArrayPool<byte>.Shared.Rent(_bufferSize); 108ArrayPool<byte>.Shared.Return(buffer); 167byte[] buffer = ArrayPool<byte>.Shared.Rent(_bufferSize); 179ArrayPool<byte>.Shared.Return(buffer);
NuGet.ProjectModel (9)
JsonPackageSpecReader.Utf8JsonStreamReader.cs (4)
1170items = ArrayPool<NuGetLogCode>.Shared.Rent(16); 1176items = ArrayPool<NuGetLogCode>.Shared.Rent(items.Length * 2); 1179ArrayPool<NuGetLogCode>.Shared.Return(oldItems); 1193ArrayPool<NuGetLogCode>.Shared.Return(items);
src\nuget-client\build\Shared\Utf8JsonStreamReader.cs (5)
56_bufferPool = arrayPool ?? ArrayPool<byte>.Shared; 216strings = ArrayPool<string>.Shared.Rent(16); 222strings = ArrayPool<string>.Shared.Rent(strings.Length * 2); 225ArrayPool<string>.Shared.Return(oldStrings); 238ArrayPool<string>.Shared.Return(strings);
PresentationCore (3)
System\Windows\Media\RenderData.cs (3)
456_buffer = ArrayPool<byte>.Shared.Rent(cbRequiredSize); 473byte[] newBuffer = ArrayPool<byte>.Shared.Rent(newSize); 486ArrayPool<byte>.Shared.Return(oldBuffer);
PresentationFramework (2)
System\Windows\Markup\Baml2006\Baml2006Reader.cs (2)
1114byte[] pooledArray = ArrayPool<byte>.Shared.Rent(toRead); 1120ArrayPool<byte>.Shared.Return(pooledArray);
Roslyn.Diagnostics.Analyzers (6)
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (4)
115byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 129ArrayPool<byte>.Shared.Return(buffer); 160byte[] buffer = ArrayPool<byte>.Shared.Rent(4096); 178ArrayPool<byte>.Shared.Return(buffer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (2)
92: System.Buffers.ArrayPool<byte>.Shared.Rent(decodedLength); 112System.Buffers.ArrayPool<byte>.Shared.Return(rentedArray);
Shared (14)
RentedSpan\RentedSpan.cs (2)
57_rentedBuffer = ArrayPool<T>.Shared.Rent(length); 81ArrayPool<T>.Shared.Return(_rentedBuffer);
ServerSentEvents\ArrayBuffer.cs (4)
46: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 139_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
ServerSentEvents\SseParser_1.cs (8)
120_lineBuffer = ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize); 180ArrayPool<byte>.Shared.Return(_lineBuffer); 183ArrayPool<byte>.Shared.Return(_dataBuffer); 200_lineBuffer = ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize); 260ArrayPool<byte>.Shared.Return(_lineBuffer); 263ArrayPool<byte>.Shared.Return(_dataBuffer); 561buffer = ArrayPool<byte>.Shared.Rent(Math.Max(minimumLength, DefaultArrayPoolRentSize)); 565ArrayPool<byte>.Shared.Return(toReturn);
System.Collections.Immutable (22)
System\Collections\Frozen\FrozenHashTable.cs (4)
65int[] arrayPoolBuckets = ArrayPool<int>.Shared.Rent(numBuckets + hashCodes.Length); 120ArrayPool<int>.Shared.Return(arrayPoolBuckets); 229int[] seenBuckets = ArrayPool<int>.Shared.Rent((maxNumBuckets / BitsPerInt32) + 1); 284ArrayPool<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)
45int[] buckets = ArrayPool<int>.Shared.Rent(arraySize); 76ArrayPool<int>.Shared.Return(buckets); 84ArrayPool<int>.Shared.Return(buckets); 95ArrayPool<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\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\IO\CachedConsoleStream.cs (2)
29Span<char> charSpan = (uint)maxCharCount <= 512 ? stackalloc char[512] : (pooledBuffer = ArrayPool<char>.Shared.Rent(maxCharCount)); 42ArrayPool<char>.Shared.Return(pooledBuffer);
System.Diagnostics.DiagnosticSource (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Diagnostics.PerformanceCounter (2)
System\Diagnostics\PerformanceDataRegistryKey.cs (2)
101ArrayPool<byte>.Shared.Return(data); 118? ArrayPool<byte>.Shared.Rent(size)
System.Diagnostics.Process (39)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcFsStat.TryReadStatusFile.cs (4)
143byte[] bytes = ArrayPool<byte>.Shared.Rent(4096); 162byte[] temp = ArrayPool<byte>.Shared.Rent(bytes.Length * 2); 166ArrayPool<byte>.Shared.Return(toReturn); 177ArrayPool<byte>.Shared.Return(bytes);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
61ArrayPool<byte>.Shared.Return(arrayBuffer); 71arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Diagnostics\Process.Linux.cs (3)
234byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 240ArrayPool<byte>.Shared.Return(toReturn); 288ArrayPool<byte>.Shared.Return(rentedArray);
System\Diagnostics\Process.Multiplexing.cs (18)
48byte[] outputBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 49byte[] errorBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 67ArrayPool<byte>.Shared.Return(outputBuffer); 68ArrayPool<byte>.Shared.Return(errorBuffer); 97byte[] outputBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 98byte[] errorBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 113ArrayPool<byte>.Shared.Return(outputBuffer); 114ArrayPool<byte>.Shared.Return(errorBuffer); 396ArrayPool<byte>.Shared.Return(standardOutput.Array!); 397ArrayPool<byte>.Shared.Return(standardError.Array!); 432ArrayPool<byte>.Shared.Return(standardOutput.Array!); 433ArrayPool<byte>.Shared.Return(standardError.Array!); 456ArrayPool<byte>.Shared.Return(outputTask.Result.Array!); 461ArrayPool<byte>.Shared.Return(errorTask.Result.Array!); 484byte[] buffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 502ArrayPool<byte>.Shared.Return(buffer); 674T[] newBuffer = ArrayPool<T>.Shared.Rent(newSize); 678ArrayPool<T>.Shared.Return(oldBuffer);
System\Diagnostics\Process.Multiplexing.Unix.cs (8)
31byte[] outputByteBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 32byte[] errorByteBuffer = ArrayPool<byte>.Shared.Rent(InitialReadAllBufferSize); 33char[] outputCharBuffer = ArrayPool<char>.Shared.Rent(InitialReadAllBufferSize); 34char[] errorCharBuffer = ArrayPool<char>.Shared.Rent(InitialReadAllBufferSize); 119ArrayPool<byte>.Shared.Return(outputByteBuffer); 120ArrayPool<byte>.Shared.Return(errorByteBuffer); 121ArrayPool<char>.Shared.Return(outputCharBuffer); 122ArrayPool<char>.Shared.Return(errorCharBuffer);
System.Drawing.Common (2)
System\Drawing\Icon.cs (2)
168char[] buffer = ArrayPool<char>.Shared.Rent(Math.Max((int)PInvokeCore.MAX_PATH, filePath.Length)); 179ArrayPool<char>.Shared.Return(buffer);
System.Formats.Asn1 (2)
src\runtime\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.Nrbf (2)
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (2)
134ArrayPool<char>.Shared.Return(assemblyQualifiedName.Array!); 209char[] rented = ArrayPool<char>.Shared.Rent(length);
System.Formats.Tar (35)
src\runtime\src\libraries\Common\src\System\IO\Archiving.Utils.cs (2)
24buffer = ArrayPool<char>.Shared.Rent(newCapacity); 25ArrayPool<char>.Shared.Return(oldBuffer);
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (4)
113byte[] buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(MaxAdvanceBufferLength, bytesToDiscard)); 125ArrayPool<byte>.Shared.Return(buffer); 140byte[] buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(MaxAdvanceBufferLength, bytesToDiscard)); 152ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Formats\Tar\GnuSparseStream.cs (6)
174byte[] rented = ArrayPool<byte>.Shared.Rent(toRead); 185ArrayPool<byte>.Shared.Return(rented); 290byte[] buffer = ArrayPool<byte>.Shared.Rent(81920); 318ArrayPool<byte>.Shared.Return(buffer); 448byte[] bytes = ArrayPool<byte>.Shared.Rent(bufferSize); 533ArrayPool<byte>.Shared.Return(bytes);
System\Formats\Tar\TarHeader.Read.cs (6)
26byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 42ArrayPool<byte>.Shared.Return(rented); 663byte[] buffer = ArrayPool<byte>.Shared.Rent((int)_size); 672ArrayPool<byte>.Shared.Return(buffer); 715byte[] buffer = ArrayPool<byte>.Shared.Rent((int)_size); 724ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarHeader.Write.cs (5)
808byte[] buffer = ArrayPool<byte>.Shared.Rent(paddingAfterData); 816ArrayPool<byte>.Shared.Return(buffer); 860ArrayPool<byte>.Shared.Return(buffer); 862span = buffer = ArrayPool<byte>.Shared.Rent(length); 885ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarHelpers.cs (4)
63byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToDiscard)); 75ArrayPool<byte>.Shared.Return(buffer); 86byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToCopy)); 100ArrayPool<byte>.Shared.Return(buffer);
System\Formats\Tar\TarWriter.cs (4)
344byte[] rented = ArrayPool<byte>.Shared.Rent(minimumLength: TarHelpers.RecordSize); 364ArrayPool<byte>.Shared.Return(rented); 376byte[] twoEmptyRecords = ArrayPool<byte>.Shared.Rent(TwoRecordSize); 384ArrayPool<byte>.Shared.Return(twoEmptyRecords);
System.IO.Compression (38)
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (4)
113byte[] buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(MaxAdvanceBufferLength, bytesToDiscard)); 125ArrayPool<byte>.Shared.Return(buffer); 140byte[] buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(MaxAdvanceBufferLength, bytesToDiscard)); 152ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
System\IO\Compression\DeflateZLib\DeflateStream.cs (6)
150_buffer = ArrayPool<byte>.Shared.Rent(DefaultBufferSize); 748ArrayPool<byte>.Shared.Return(buffer); 803ArrayPool<byte>.Shared.Return(buffer); 938_arrayPoolBuffer = ArrayPool<byte>.Shared.Rent(bufferSize); 980ArrayPool<byte>.Shared.Return(_arrayPoolBuffer); 1021ArrayPool<byte>.Shared.Return(_arrayPoolBuffer);
System\IO\Compression\WinZipAesKeyMaterial.cs (2)
65byte[] rentedPasswordBytes = ArrayPool<byte>.Shared.Rent(maxPasswordByteCount); 93ArrayPool<byte>.Shared.Return(rentedPasswordBytes);
System\IO\Compression\ZipArchive.Async.cs (2)
217byte[] arrayPoolArray = ArrayPool<byte>.Shared.Rent(ReadCentralDirectoryReadBufferSize); 261ArrayPool<byte>.Shared.Return(arrayPoolArray);
System\IO\Compression\ZipArchive.cs (2)
663byte[] arrayPoolArray = ArrayPool<byte>.Shared.Rent(ReadCentralDirectoryReadBufferSize); 707ArrayPool<byte>.Shared.Return(arrayPoolArray);
System\IO\Compression\ZipBlocks.Async.cs (4)
144byte[] arrayPoolBuffer = ArrayPool<byte>.Shared.Rent(extraFieldLength); 160ArrayPool<byte>.Shared.Return(arrayPoolBuffer); 213arrayPoolBuffer = ArrayPool<byte>.Shared.Rent(dynamicHeaderSize); 235ArrayPool<byte>.Shared.Return(arrayPoolBuffer);
System\IO\Compression\ZipBlocks.cs (4)
643byte[]? arrayPoolBuffer = extraFieldLength > StackAllocationThreshold ? ArrayPool<byte>.Shared.Rent(extraFieldLength) : null; 656ArrayPool<byte>.Shared.Return(arrayPoolBuffer); 1023arrayPoolBuffer = ArrayPool<byte>.Shared.Rent(dynamicHeaderSize); 1046ArrayPool<byte>.Shared.Return(arrayPoolBuffer);
System\IO\Compression\ZipCryptoStream.cs (2)
129byte[] passwordBytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(password.Length)); 141ArrayPool<byte>.Shared.Return(passwordBytes);
System\IO\Compression\ZipHelper.Async.cs (2)
31byte[] buffer = ArrayPool<byte>.Shared.Rent(BackwardsSeekingBufferSize); 83ArrayPool<byte>.Shared.Return(buffer);
System\IO\Compression\ZipHelper.cs (2)
105byte[] buffer = ArrayPool<byte>.Shared.Rent(BackwardsSeekingBufferSize); 157ArrayPool<byte>.Shared.Return(buffer);
System\IO\Compression\Zstandard\ZstandardDictionary.cs (4)
105byte[] lengthsArray = ArrayPool<byte>.Shared.Rent(sampleLengths.Length * sizeof(nuint)); 131dictionaryBuffer = ArrayPool<byte>.Shared.Rent(maxDictionarySize); 153ArrayPool<byte>.Shared.Return(dictionaryBuffer); 155ArrayPool<byte>.Shared.Return(lengthsArray);
System.IO.Compression.Brotli (2)
System\IO\Compression\BrotliStream.cs (2)
59_buffer = ArrayPool<byte>.Shared.Rent(DefaultInternalBufferSize); 159ArrayPool<byte>.Shared.Return(buffer);
System.IO.Compression.ZipFile (2)
src\runtime\src\libraries\Common\src\System\IO\Archiving.Utils.cs (2)
24buffer = ArrayPool<char>.Shared.Rent(newCapacity); 25ArrayPool<char>.Shared.Return(oldBuffer);
System.IO.FileSystem.AccessControl (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.IO.FileSystem.Watcher (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.IO.Packaging (2)
System\IO\Packaging\InterleavedZipPackagePartStream.cs (2)
546byte[] readBuffer = ArrayPool<byte>.Shared.Rent(BufferSize); 562ArrayPool<byte>.Shared.Return(readBuffer);
System.IO.Pipelines (5)
System\IO\Pipelines\BufferSegment.cs (1)
84ArrayPool<byte>.Shared.Return(_array);
System\IO\Pipelines\Pipe.cs (2)
288segment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(sizeToRequest)); 310: ArrayPool<byte>.Shared.Rent(GetSegmentSize(sizeHint));
System\IO\Pipelines\StreamPipeReader.cs (1)
526nextSegment.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)
74ArrayPool<T>.Shared.Return(segment); 80ArrayPool<T>.Shared.Return(currentSegment); 93ArrayPool<T>.Shared.Return(segment); 355_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 (36)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (1)
128private static ArrayPool<byte> Pool => ArrayPool<byte>.Shared;
src\runtime\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\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Net\Http\Headers\HeaderDescriptor.cs (2)
313char[] rented = ArrayPool<char>.Shared.Rent(input.Length); 325ArrayPool<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 (6)
183byte[] buffer = ArrayPool<byte>.Shared.Rent((int)stream.Length); 188ArrayPool<byte>.Shared.Return(buffer); 997newBuffer = ArrayPool<byte>.Shared.Rent(newBufferCapacity); 1017newBuffer = ArrayPool<byte>.Shared.Rent(newBufferCapacity); 1094ArrayPool<byte>.Shared.Return(buffer); 1105ArrayPool<byte>.Shared.Return(lastBuffer);
System\Net\Http\MultipartContent.cs (2)
641: (rentedBuffer = ArrayPool<byte>.Shared.Rent(maxLength)); 652ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (2)
443HttpConnection[] stackCopy = ArrayPool<HttpConnection>.Shared.Rent(pool._associatedHttp11ConnectionCount); 468ArrayPool<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)
2001byte[] pooledBuffer = ArrayPool<byte>.Shared.Rent(desiredBufferSize); 2021ArrayPool<byte>.Shared.Return(pooledBuffer);
System\Net\Http\SocketsHttpHandler\SocksHelper.cs (4)
68byte[] buffer = ArrayPool<byte>.Shared.Rent(BufferSize); 210ArrayPool<byte>.Shared.Return(buffer); 216byte[] buffer = ArrayPool<byte>.Shared.Rent(BufferSize); 317ArrayPool<byte>.Shared.Return(buffer);
System.Net.Http.WinHttpHandler (6)
System\Net\Http\WinHttpResponseParser.cs (2)
32char[] buffer = ArrayPool<char>.Shared.Rent(bufferLength); 78ArrayPool<char>.Shared.Return(buffer);
System\Net\Http\WinHttpResponseStream.cs (4)
104return CopyToAsyncCore(destination, ArrayPool<byte>.Shared.Rent(bufferSize), cancellationToken); 165ArrayPool<byte>.Shared.Return(buffer); 278char[] trailersBuffer = ArrayPool<char>.Shared.Rent(bufferLength); 285ArrayPool<char>.Shared.Return(trailersBuffer);
System.Net.Mail (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Net.NameResolution (21)
System\Net\DnsResolverPal.Managed.cs (21)
397byte[] queryBytes = ArrayPool<byte>.Shared.Rent(MaxUdpResponseSize); 404byte[] responseBuffer = ArrayPool<byte>.Shared.Rent(MaxUdpResponseSize); 444ArrayPool<byte>.Shared.Return(tcpBuffer); 460ArrayPool<byte>.Shared.Return(tcpBuffer); 465ArrayPool<byte>.Shared.Return(responseBuffer); 468ArrayPool<byte>.Shared.Return(softErrorBuffer); 486responseBuffer = ArrayPool<byte>.Shared.Rent(MaxUdpResponseSize); 495ArrayPool<byte>.Shared.Return(softErrorBuffer); 503ArrayPool<byte>.Shared.Return(responseBuffer); 506ArrayPool<byte>.Shared.Return(softErrorBuffer); 530ArrayPool<byte>.Shared.Return(responseBuffer); 547ArrayPool<byte>.Shared.Return(queryBytes); 701byte[] buffer = ArrayPool<byte>.Shared.Rent(InitialTcpBufferSize); 713ArrayPool<byte>.Shared.Return(buffer); 714buffer = ArrayPool<byte>.Shared.Rent(responseLength); 722ArrayPool<byte>.Shared.Return(buffer); 738byte[] buffer = ArrayPool<byte>.Shared.Rent(InitialTcpBufferSize); 750ArrayPool<byte>.Shared.Return(buffer); 751buffer = ArrayPool<byte>.Shared.Rent(responseLength); 759ArrayPool<byte>.Shared.Return(buffer); 933public void Dispose() => ArrayPool<byte>.Shared.Return(_buffer);
System.Net.Primitives (2)
src\runtime\src\libraries\Common\src\System\Net\NetworkInformation\InterfaceInfoPal.Unix.cs (2)
47: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferSize))) 70ArrayPool<byte>.Shared.Return(rentedBuffer);
System.Net.Quic (15)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs (2)
35byte[] buffer = ArrayPool<byte>.Shared.Rent(1024); 44ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
src\runtime\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 (39)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs (2)
35byte[] buffer = ArrayPool<byte>.Shared.Rent(1024); 44ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (4)
621byte[] buffer = ArrayPool<byte>.Shared.Rent(512); 669ArrayPool<byte>.Shared.Return(buffer); 680buffer = ArrayPool<byte>.Shared.Rent(buffer.Length * 2); 682ArrayPool<byte>.Shared.Return(oldBuffer);
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Net\Security\RC4.cs (2)
46state = ArrayPool<byte>.Shared.Rent(256); 71ArrayPool<byte>.Shared.Return(state);
src\runtime\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\runtime\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\NegotiateAuthentication.cs (2)
282rentedBuffer = ArrayPool<byte>.Shared.Rent((incomingBlob.Length / 4) * 3); 306ArrayPool<byte>.Shared.Return(rentedBuffer, clearArray: true);
System\Net\Security\SslStream.Protocol.cs (4)
1567Payload = RentBuffer ? ArrayPool<byte>.Shared.Rent(Size) : new byte[Size]; 1581Payload = RentBuffer ? ArrayPool<byte>.Shared.Rent(Size + size) : new byte[Size + size]; 1587ArrayPool<byte>.Shared.Return(oldPayload); 1606ArrayPool<byte>.Shared.Return(toReturn);
System\Net\Security\SslStreamCertificateContext.Linux.cs (5)
292IntPtr[] issuerHandles = ArrayPool<IntPtr>.Shared.Rent(_privateIntermediateCertificates.Length + 1); 310byte[] rentedBytes = ArrayPool<byte>.Shared.Rent(Interop.Crypto.GetOcspRequestDerSize(ocspRequest)); 353ArrayPool<IntPtr>.Shared.Return(issuerHandles); 354ArrayPool<byte>.Shared.Return(rentedBytes); 355ArrayPool<char>.Shared.Return(rentedChars.Array!);
System\Net\Security\TlsSession.cs (11)
1175byte[] rented = ArrayPool<byte>.Shared.Rent(chunk); 1208ArrayPool<byte>.Shared.Return(rented); 1577ArrayPool<byte>.Shared.Return(_decryptScratch); 1579_decryptScratch = ArrayPool<byte>.Shared.Rent(size); 1961byte[] scratch = ArrayPool<byte>.Shared.Rent(SocketScratchSize); 2051ArrayPool<byte>.Shared.Return(scratch); 2170byte[] scratch = ArrayPool<byte>.Shared.Rent(SocketScratchSize); 2231ArrayPool<byte>.Shared.Return(scratch); 2255byte[] scratch = ArrayPool<byte>.Shared.Rent(SocketScratchSize); 2285ArrayPool<byte>.Shared.Return(scratch); 2362ArrayPool<byte>.Shared.Return(_decryptScratch);
System.Net.ServerSentEvents (12)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
System\Net\ServerSentEvents\SseParser_1.cs (8)
107_lineBuffer = ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize); 167ArrayPool<byte>.Shared.Return(_lineBuffer); 170ArrayPool<byte>.Shared.Return(_dataBuffer); 187_lineBuffer = ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize); 247ArrayPool<byte>.Shared.Return(_lineBuffer); 250ArrayPool<byte>.Shared.Return(_dataBuffer); 565buffer = ArrayPool<byte>.Shared.Rent(Math.Max(minimumLength, DefaultArrayPoolRentSize)); 569ArrayPool<byte>.Shared.Return(toReturn);
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); 221ArrayPool<byte>.Shared.Return(toReturn);
System\Net\WebSockets\ManagedWebSocket.cs (7)
1469byte[] closeBuffer = ArrayPool<byte>.Shared.Rent(MaxMessageHeaderLength + MaxControlPayloadLength); 1512ArrayPool<byte>.Shared.Return(closeBuffer); 1554buffer = ArrayPool<byte>.Shared.Rent(count); 1559buffer = ArrayPool<byte>.Shared.Rent(count); 1572ArrayPool<byte>.Shared.Return(buffer); 1645_sendBuffer = ArrayPool<byte>.Shared.Rent(minLength); 1656ArrayPool<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.Numerics.Tensors (23)
System\Numerics\Tensors\netcore\Tensor.cs (10)
257T[] tempBuffer = ArrayPool<T>.Shared.Rent((int)totalLength); 267ArrayPool<T>.Shared.Return(tempBuffer); 3659T[] flat = ArrayPool<T>.Shared.Rent((int)x.FlattenedLength); 3667ArrayPool<T>.Shared.Return(flat); 3691T[] flat = ArrayPool<T>.Shared.Rent((int)x.FlattenedLength); 3699ArrayPool<T>.Shared.Return(flat); 3722T[] flat = ArrayPool<T>.Shared.Rent((int)x.FlattenedLength); 3730ArrayPool<T>.Shared.Return(flat); 3755T[] flat = ArrayPool<T>.Shared.Rent((int)x.FlattenedLength); 3763ArrayPool<T>.Shared.Return(flat);
System\Numerics\Tensors\netcore\TensorOperation.cs (4)
369: (resultLengthsArray = ArrayPool<nint>.Shared.Rent(maxRank)); 389ArrayPool<nint>.Shared.Return(resultLengthsArray); 2758rentedBuffer._array = ArrayPool<T>.Shared.Rent(rank); 2778ArrayPool<T>.Shared.Return(_array);
System\Numerics\Tensors\netcore\TensorShape.cs (9)
165stridesOrderArray = ArrayPool<int>.Shared.Rent(rank); 710lengthsArray = ArrayPool<nint>.Shared.Rent(rank); 733ArrayPool<nint>.Shared.Return(lengthsArray); 767intermediateLengthsArray = ArrayPool<nint>.Shared.Rent(rank); 827ArrayPool<nint>.Shared.Return(intermediateLengthsArray); 1122intermediateLengthsArray = ArrayPool<nint>.Shared.Rent(rank); 1125intermediateStridesArray = ArrayPool<nint>.Shared.Rent(rank); 1226ArrayPool<nint>.Shared.Return(intermediateLengthsArray); 1231ArrayPool<nint>.Shared.Return(intermediateStridesArray);
System.Private.CoreLib (161)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcFsStat.TryReadStatusFile.cs (4)
143byte[] bytes = ArrayPool<byte>.Shared.Rent(4096); 162byte[] temp = ArrayPool<byte>.Shared.Rent(bytes.Length * 2); 166ArrayPool<byte>.Shared.Return(toReturn); 177ArrayPool<byte>.Shared.Return(bytes);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetCwd.cs (2)
31byte[] buf = ArrayPool<byte>.Shared.Rent(bufferSize); 45ArrayPool<byte>.Shared.Return(buf);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
61ArrayPool<byte>.Shared.Return(arrayBuffer); 71arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (5)
174ArrayPool<T>.Shared.Return(toReturn, pos); 178ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 238ArrayPool<T>.Shared.Return(toReturn, _pos); 242ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (4)
109: (rented = ArrayPool<byte>.Shared.Rent(upperBound)); 117ArrayPool<byte>.Shared.Return(rented); 241: (rented = ArrayPool<byte>.Shared.Rent(upperBound)); 249ArrayPool<byte>.Shared.Return(rented);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (4)
169: (rented = ArrayPool<byte>.Shared.Rent(upperBound)); 177ArrayPool<byte>.Shared.Return(rented); 267: (rented = ArrayPool<byte>.Shared.Rent(upperBound)); 274ArrayPool<byte>.Shared.Return(rented);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (4)
886: (borrowedArray = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 908ArrayPool<byte>.Shared.Return(borrowedArray); 911sortKey = (borrowedArray = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 938ArrayPool<byte>.Shared.Return(borrowedArray);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (2)
146(borrowedArr = ArrayPool<byte>.Shared.Rent(sortKeyLength)); 165ArrayPool<byte>.Shared.Return(borrowedArr);
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (4)
62: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 104ArrayPool<char>.Shared.Return(temp); 107buffer = toReturn = ArrayPool<char>.Shared.Rent(realLen); 117ArrayPool<char>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (4)
54: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 86ArrayPool<char>.Shared.Return(temp); 89buffer = toReturn = ArrayPool<char>.Shared.Rent(realLength); 110ArrayPool<char>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
525byte[] buffer = ArrayPool<byte>.Shared.Rent(numBytes); 527ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (10)
198rented = ArrayPool<byte>.Shared.Rent(maxByteCount); 207ArrayPool<byte>.Shared.Return(rented); 370byte[] rented = ArrayPool<byte>.Shared.Rent(value.Length * 3); // max expansion: each char -> 3 bytes 374ArrayPool<byte>.Shared.Return(rented); 395byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length); 403ArrayPool<byte>.Shared.Return(array); 433rented = ArrayPool<byte>.Shared.Rent(maxByteCount); 436ArrayPool<byte>.Shared.Return(rented); 446rented = ArrayPool<byte>.Shared.Rent(MaxArrayPoolRentalSize); 461ArrayPool<byte>.Shared.Return(rented);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs (2)
58_pathBuffer = ArrayPool<char>.Shared.Rent(StandardBufferSize); 244ArrayPool<char>.Shared.Return(pathBuffer);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (13)
1133buffer = ArrayPool<char>.Shared.Rent(sr.CurrentEncoding.GetMaxCharCount(DefaultBufferSize)); 1151ArrayPool<char>.Shared.Return(buffer); 1250byte[] rentedArray = ArrayPool<byte>.Shared.Rent(512); 1264byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 1270ArrayPool<byte>.Shared.Return(toReturn); 1285ArrayPool<byte>.Shared.Return(rentedArray); 1529byte[] tmp = ArrayPool<byte>.Shared.Rent((int)newLength); 1535ArrayPool<byte>.Shared.Return(oldRentedArray); 1552ArrayPool<byte>.Shared.Return(rentedArray); 1577Span<byte> bytes = (uint)bytesNeeded <= 1024 ? stackalloc byte[1024] : (rentedBytes = ArrayPool<byte>.Shared.Rent(bytesNeeded)); 1608ArrayPool<byte>.Shared.Return(rentedBytes); 1631byte[] bytes = ArrayPool<byte>.Shared.Rent(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1660ArrayPool<byte>.Shared.Return(bytes);
src\runtime\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); 316byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 329ArrayPool<byte>.Shared.Return(localBuffer); 740byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 753ArrayPool<byte>.Shared.Return(localBuffer); 785byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 799ArrayPool<byte>.Shared.Return(sharedBuffer); 917byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 925ArrayPool<byte>.Shared.Return(sharedBuffer);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (5)
963ArrayPool<char>.Shared.Return(arrayPoolBuffer); 989arrayPoolBuffer = ArrayPool<char>.Shared.Rent(charLen - charPos + 80); 993char[] newBuffer = ArrayPool<char>.Shared.Rent(checked(arrayPoolBufferPos + charLen - charPos)); 995ArrayPool<char>.Shared.Return(arrayPoolBuffer); 1006ArrayPool<char>.Shared.Return(arrayPoolBuffer);
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (4)
192char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 201ArrayPool<char>.Shared.Return(array); 416char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 425ArrayPool<char>.Shared.Return(array);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (2)
87Span<char> scratch = (uint)count <= 64 ? stackalloc char[64] : (borrowedArr = ArrayPool<char>.Shared.Rent(count)); 99ArrayPool<char>.Shared.Return(borrowedArr);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128DecimalReduce.cs (2)
157: (rented = ArrayPool<ulong>.Shared.Rent(maxWords)); 164ArrayPool<ulong>.Shared.Return(rented);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\INumberBase.cs (15)
319utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 330ArrayPool<char>.Shared.Return(utf16TextArray); 345ArrayPool<char>.Shared.Return(utf16TextArray); 501utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 512ArrayPool<char>.Shared.Return(utf16TextArray); 528ArrayPool<char>.Shared.Return(utf16TextArray); 571utf16DestinationArray = ArrayPool<char>.Shared.Rent(destinationMaxCharCount); 580ArrayPool<char>.Shared.Return(utf16DestinationArray); 595ArrayPool<char>.Shared.Return(utf16DestinationArray); 627utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 638ArrayPool<char>.Shared.Return(utf16TextArray); 653ArrayPool<char>.Shared.Return(utf16TextArray); 674utf16TextArray = ArrayPool<char>.Shared.Rent(textMaxCharCount); 685ArrayPool<char>.Shared.Return(utf16TextArray); 701ArrayPool<char>.Shared.Return(utf16TextArray);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (6)
215: rented = ArrayPool<byte>.Shared.Rent(byteCount); 239ArrayPool<byte>.Shared.Return(rented); 351: rented = ArrayPool<byte>.Shared.Rent(byteCount); 372ArrayPool<byte>.Shared.Return(rented); 390: rented = ArrayPool<byte>.Shared.Rent(byteCount); 410ArrayPool<byte>.Shared.Return(rented);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncProfiler.cs (2)
1821ArrayPool<byte>.Shared.Return(rentedArray); 1878rentedArray = ArrayPool<byte>.Shared.Rent(minimumLength);
src\runtime\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)); 136ArrayPool<char>.Shared.Return(toReturn); 655char[] newArray = ArrayPool<char>.Shared.Rent(arraySize); 663ArrayPool<char>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (3)
169bool[] seen = ArrayPool<bool>.Shared.Rent(modulus); 180ArrayPool<bool>.Shared.Return(seen); 188ArrayPool<bool>.Shared.Return(seen);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (2)
1003(borrowedArr = ArrayPool<char>.Shared.Rent(length + 1)); 1029ArrayPool<char>.Shared.Return(borrowedArr);
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (4)
707char[] array = ArrayPool<char>.Shared.Rent(length); 717ArrayPool<char>.Shared.Return(array); 754char[] array = ArrayPool<char>.Shared.Rent(length); 764ArrayPool<char>.Shared.Return(array);
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Cache.cs (4)
506T[] tmp = ArrayPool<T>.Shared.Rent(Math.Max(arrayPoolArray.Length * 2, requiredCapacity)); 508ArrayPool<T>.Shared.Return(arrayPoolArray); 652TimeTransition[] allTransitions = ArrayPool<TimeTransition>.Shared.Rent(InitialTransitionsCount); 1328ArrayPool<TimeTransition>.Shared.Return(allTransitions);
System.Private.CoreLib.Generators (3)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
System.Private.Uri (7)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Private.Windows.Core (10)
System\BufferScope.cs (5)
24_array = ArrayPool<T>.Shared.Rent(minimumLength); 66_array = ArrayPool<T>.Shared.Rent(minimumLength); 88T[] newArray = ArrayPool<T>.Shared.Rent(capacity); 96ArrayPool<T>.Shared.Return(_array); 123ArrayPool<T>.Shared.Return(_array);
System\Text\ValueStringBuilder.cs (5)
27_chars = ArrayPool<char>.Shared.Rent( 41_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 334char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 342ArrayPool<char>.Shared.Return(toReturn); 353ArrayPool<char>.Shared.Return(toReturn);
System.Private.Xml (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Reflection.Metadata (6)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Reflection\Internal\Utilities\EncodingHelper.cs (2)
45byte[] buffer = ArrayPool<byte>.Shared.Rent(prefixedByteCount); 56ArrayPool<byte>.Shared.Return(buffer);
System.Runtime.Numerics (34)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder_1.cs (4)
34_arrayToReturnToPool = ArrayPool<TChar>.Shared.Rent(initialCapacity); 299TChar[] poolArray = ArrayPool<TChar>.Shared.Rent(newCapacity); 307ArrayPool<TChar>.Shared.Return(toReturn); 318ArrayPool<TChar>.Shared.Return(toReturn);
System\Number.BigInteger.cs (10)
118buffer = arrayFromPool = ArrayPool<byte>.Shared.Rent(value.Length + 1 + 1); 141ArrayPool<byte>.Shared.Return(arrayFromPool); 626bits = arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(bytesWrittenOrNeeded); 685ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 710bytes = arrayToReturnToPool = ArrayPool<byte>.Shared.Rent(bytesWrittenOrNeeded); 727ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 745ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 781ArrayPool<byte>.Shared.Return(arrayToReturnToPool); 933(numberBufferToReturn = ArrayPool<byte>.Shared.Rent(valueDigits + 1)); 976ArrayPool<byte>.Shared.Return(numberBufferToReturn);
System\Numerics\BigInteger.RentedBuffer.cs (3)
37nuint[] array = ArrayPool<nuint>.Shared.Rent(size); 53/// This method returns the underlying array to <see cref="ArrayPool{T}.Shared"/> if it was rented. 62ArrayPool<nuint>.Shared.Return(array);
System\Numerics\BigIntegerCalculator.PowMod.cs (2)
552nuint[] tablePool = ArrayPool<nuint>.Shared.Rent(totalTableLen); 641ArrayPool<nuint>.Shared.Return(tablePool);
System\Numerics\BigIntegerCalculator.SquMul.cs (12)
73nuint[] pAndQAllFromPool = ArrayPool<nuint>.Shared.Rent(pAndQAllLength); 82nuint[] rAndZAllFromPool = ArrayPool<nuint>.Shared.Rent(rAndZAllLength); 88ArrayPool<nuint>.Shared.Return(pAndQAllFromPool); 89ArrayPool<nuint>.Shared.Return(rAndZAllFromPool); 282nuint[] pAndQAllFromPool = ArrayPool<nuint>.Shared.Rent(pAndQAllLength); 292nuint[] rAndZAllFromPool = ArrayPool<nuint>.Shared.Rent(rAndZAllLength); 298ArrayPool<nuint>.Shared.Return(pAndQAllFromPool); 299ArrayPool<nuint>.Shared.Return(rAndZAllFromPool); 329nuint[] pAndQAllFromPool = ArrayPool<nuint>.Shared.Rent(pAndQAllLength); 365nuint[] cAllFromPool = ArrayPool<nuint>.Shared.Rent(cAllLength); 391ArrayPool<nuint>.Shared.Return(pAndQAllFromPool); 396ArrayPool<nuint>.Shared.Return(cAllFromPool);
System.Security.Cryptography (58)
src\runtime\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\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (6)
918_certBags = ArrayPool<SafeBagAsn>.Shared.Rent(loaderLimits.MaxCertificates.GetValueOrDefault(10)); 919_keyBags = ArrayPool<SafeBagAsn>.Shared.Rent(loaderLimits.MaxKeys.GetValueOrDefault(10)); 929ArrayPool<SafeBagAsn>.Shared.Return(_certBags, clearArray: true); 934ArrayPool<SafeBagAsn>.Shared.Return(_keyBags, clearArray: true); 1075SafeBagAsn[] next = ArrayPool<SafeBagAsn>.Shared.Rent(checked(index + 1)); 1077ArrayPool<SafeBagAsn>.Shared.Return(array, clearArray: true);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Security\Cryptography\CngAsnFormatter.cs (2)
35(pooledarray = ArrayPool<char>.Shared.Rent(charLength)); 50ArrayPool<char>.Shared.Return(pooledarray);
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); 1408byte[] rented = ArrayPool<byte>.Shared.Rent(resultSize); 1424ArrayPool<byte>.Shared.Return(rented);
System\Security\Cryptography\SymmetricAlgorithm.cs (2)
772byte[] decryptRent = ArrayPool<byte>.Shared.Rent(ciphertext.Length); 786ArrayPool<byte>.Shared.Return(decryptRent);
System\Security\Cryptography\X509Certificates\CertificateRequest.Load.cs (2)
53byte[] rented = ArrayPool<byte>.Shared.Rent(fields.DecodedDataLength); 74ArrayPool<byte>.Shared.Return(rented);
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (2)
272byte[] rented = ArrayPool<byte>.Shared.Rent(fields.DecodedDataLength); 285ArrayPool<byte>.Shared.Return(rented);
System.Security.Cryptography.Cose (16)
System\Security\Cryptography\Cose\CoseMessage.cs (4)
458byte[] contentBuffer = ArrayPool<byte>.Shared.Rent(4096); 470ArrayPool<byte>.Shared.Return(contentBuffer, clearArray: true); 494byte[] contentBuffer = ArrayPool<byte>.Shared.Rent(4096); 505ArrayPool<byte>.Shared.Return(contentBuffer, clearArray: true);
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (4)
778byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, signer.CoseKey.ComputeSignatureSize())); 800ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 854byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, signer.CoseKey.ComputeSignatureSize())); 872ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System\Security\Cryptography\Cose\CoseSign1Message.cs (4)
784byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 799ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 938byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 948ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System\Security\Cryptography\Cose\CoseSignature.cs (4)
625byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 641ArrayPool<byte>.Shared.Return(buffer, clearArray: true); 658byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferLength); 674ArrayPool<byte>.Shared.Return(buffer, clearArray: true);
System.Security.Cryptography.Pkcs (2)
src\runtime\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.ServiceModel.NetFramingBase (12)
System\ServiceModel\Channels\Connection.cs (4)
203byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 212ArrayPool<byte>.Shared.Return(sharedBuffer); 242byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 252ArrayPool<byte>.Shared.Return(sharedBuffer);
System\ServiceModel\Channels\FramingChannels.cs (1)
380byte[] faultBuffer = ArrayPool<byte>.Shared.Rent(FaultStringDecoder.FaultSizeQuota);
System\ServiceModel\Channels\SessionConnectionReader.cs (2)
88ArrayPool<byte>.Shared.Return(_buffer); 107_buffer = ArrayPool<byte>.Shared.Rent(_connection.ConnectionBufferSize);
System\ServiceModel\Channels\SingletonConnectionReader.cs (5)
137byte[] buffer = ArrayPool<byte>.Shared.Rent(Connection.ConnectionBufferSize); 159ArrayPool<byte>.Shared.Return(buffer); 174ArrayPool<byte>.Shared.Return(buffer); 538byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 551ArrayPool<byte>.Shared.Return(localBuffer);
System.ServiceProcess.ServiceController (4)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Text.Encodings.Web (6)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<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 (213)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (4)
45: usePool ? ArrayPool<byte>.Shared.Rent(initialSize) : new byte[initialSize]; 138_bytes = ArrayPool<byte>.Shared.Rent(byteCount); 164ArrayPool<byte>.Shared.Rent(newSize) : 193ArrayPool<byte>.Shared.Return(buffer);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (4)
48: (rentedBuffer = ArrayPool<char>.Shared.Rent(initialBufferLength)); 169ArrayPool<char>.Shared.Return(rentedBuffer); 188char[] newBuffer = ArrayPool<char>.Shared.Rent(newSize); 194ArrayPool<char>.Shared.Return(rentedBuffer);
System\Text\Json\Document\JsonDocument.cs (5)
81ArrayPool<byte>.Shared.Return(extraRentedBytes); 314(otherUtf8TextArray = ArrayPool<byte>.Shared.Rent(length)); 332ArrayPool<byte>.Shared.Return(otherUtf8TextArray); 827byte[] rent = ArrayPool<byte>.Shared.Rent(length); 838ArrayPool<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); 250_data = ArrayPool<byte>.Shared.Rent(newCapacity); 256ArrayPool<byte>.Shared.Return(toReturn);
System\Text\Json\Document\JsonDocument.Parse.cs (22)
87byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(length); 102ArrayPool<byte>.Shared.Return(utf8Bytes); 140ArrayPool<byte>.Shared.Return(drained.Array); 167ArrayPool<byte>.Shared.Return(drained.Array); 237ArrayPool<byte>.Shared.Return(drained.Array); 255ArrayPool<byte>.Shared.Return(drained.Array); 286byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(expectedByteCount); 303ArrayPool<byte>.Shared.Return(utf8Bytes); 312byte[] utf8Bytes = ArrayPool<byte>.Shared.Rent(expectedByteCount); 326ArrayPool<byte>.Shared.Return(utf8Bytes); 647byte[] rented = ArrayPool<byte>.Shared.Rent(length); 669ArrayPool<byte>.Shared.Return(rented); 811rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); 815rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); 846rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2)); 849ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); 864ArrayPool<byte>.Shared.Return(rented); 894rented = ArrayPool<byte>.Shared.Rent(checked((int)expectedLength)); 898rented = ArrayPool<byte>.Shared.Rent(UnseekableStreamInitialRentSize); 926rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2); 929ArrayPool<byte>.Shared.Return(toReturn, clearArray: true); 946ArrayPool<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)
85(array = ArrayPool<byte>.Shared.Rent(expectedByteCount)); 99ArrayPool<byte>.Shared.Return(array);
System\Text\Json\JsonHelpers.cs (2)
208(rentedBuffer = ArrayPool<char>.Shared.Rent(utf8Key.Length)); 218ArrayPool<char>.Shared.Return(rentedBuffer);
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 (19)
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); 175(unescapedArray1 = ArrayPool<byte>.Shared.Rent(utf8Source1.Length)); 179(unescapedArray2 = ArrayPool<byte>.Shared.Rent(utf8Source2.Length)); 194ArrayPool<byte>.Shared.Return(unescapedArray1); 200ArrayPool<byte>.Shared.Return(unescapedArray2); 224(pooledArray = ArrayPool<byte>.Shared.Rent(utf8Unescaped.Length)); 235ArrayPool<byte>.Shared.Return(pooledArray); 247ArrayPool<byte>.Shared.Return(pooledArray);
System\Text\Json\Reader\Utf8JsonReader.cs (2)
544otherUtf8TextArray = ArrayPool<byte>.Shared.Rent(length); 568ArrayPool<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)
114ArrayPool<FoundProperty>.Shared.Return(toReturn, clearArray: true); 270ArrayPool<FoundPropertyAsync>.Shared.Return(toReturn, clearArray: true); 366ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 373var newCache = ArrayPool<FoundProperty>.Shared.Rent(argumentState.FoundProperties.Length * 2); 380ArrayPool<FoundProperty>.Shared.Return(toReturn, clearArray: true); 562argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 568var newCache = ArrayPool<FoundPropertyAsync>.Shared.Rent(argumentState.FoundPropertiesAsync!.Length * 2); 575ArrayPool<FoundPropertyAsync>.Shared.Return(toReturn, clearArray: true);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.Large.cs (2)
48ArrayPool<object>.Shared.Return(arguments, clearArray: true); 56object?[] arguments = ArrayPool<object>.Shared.Rent(typeInfo.ParameterCache.Length);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (2)
246: (rentedBuffer = ArrayPool<char>.Shared.Rent(bufferLength)); 291ArrayPool<char>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Value\HalfConverter.cs (2)
59: (rentedByteBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 67ArrayPool<byte>.Shared.Return(rentedByteBuffer);
System\Text\Json\Serialization\Converters\Value\Ieee754FloatingPointConverter.cs (3)
148: (rentedByteBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 272rented = ArrayPool<byte>.Shared.Rent(destination.Length * 2); 285ArrayPool<byte>.Shared.Return(rented);
System\Text\Json\Serialization\Converters\Value\Int128Converter.cs (2)
54: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 64ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (2)
54: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 64ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\Converters\Value\VersionConverter.cs (2)
43: (rentedBuffer = ArrayPool<byte>.Shared.Rent(bufferLength)); 66ArrayPool<byte>.Shared.Return(rentedBuffer);
System\Text\Json\Serialization\JsonSerializer.Read.String.cs (4)
391json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 407ArrayPool<byte>.Shared.Return(tempArray); 422json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 438ArrayPool<byte>.Shared.Return(tempArray);
System\Text\Json\Serialization\JsonUnionTypeStructuralClassifier.cs (4)
396: (rentedPocoCaseStates = ArrayPool<PocoObjectCaseState>.Shared.Rent(_pocoObjectCases.Length)); 444ArrayPool<PocoObjectCaseState>.Shared.Return( 502: (rentedPropertyName = ArrayPool<byte>.Shared.Rent(bufferLength)); 525ArrayPool<byte>.Shared.Return(rentedPropertyName);
System\Text\Json\Serialization\StreamReadBufferState.cs (4)
46_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length)); 139byte[] newBuffer = ArrayPool<byte>.Shared.Rent((_buffer.Length < (int.MaxValue / 2)) ? _buffer.Length * 2 : int.MaxValue); 148ArrayPool<byte>.Shared.Return(oldBuffer); 197ArrayPool<byte>.Shared.Return(toReturn);
System\Text\Json\Writer\JsonWriterHelper.cs (4)
316? (rented = ArrayPool<byte>.Shared.Rent(quotedLength)).AsSpan(0, quotedLength) 329ArrayPool<byte>.Shared.Return(rented); 346rented = ArrayPool<byte>.Shared.Rent(length); 364ArrayPool<byte>.Shared.Return(rented);
System\Text\Json\Writer\Utf8JsonWriter.cs (4)
870(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 878ArrayPool<byte>.Shared.Return(propertyArray); 1019(propertyArray = ArrayPool<char>.Shared.Rent(length)); 1027ArrayPool<char>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Bytes.cs (4)
145(propertyArray = ArrayPool<char>.Shared.Rent(length)); 153ArrayPool<char>.Shared.Return(propertyArray); 168(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 176ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTime.cs (4)
152(propertyArray = ArrayPool<char>.Shared.Rent(length)); 160ArrayPool<char>.Shared.Return(propertyArray); 175(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 183ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.DateTimeOffset.cs (4)
151(propertyArray = ArrayPool<char>.Shared.Rent(length)); 159ArrayPool<char>.Shared.Return(propertyArray); 174(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 182ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Decimal.cs (4)
151(propertyArray = ArrayPool<char>.Shared.Rent(length)); 159ArrayPool<char>.Shared.Return(propertyArray); 174(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 182ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Double.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.Float.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.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)
151(propertyArray = ArrayPool<char>.Shared.Rent(length)); 159ArrayPool<char>.Shared.Return(propertyArray); 174(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 182ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.Literal.cs (4)
270(propertyArray = ArrayPool<char>.Shared.Rent(length)); 278ArrayPool<char>.Shared.Return(propertyArray); 293(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 301ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.SignedNumber.cs (4)
224(propertyArray = ArrayPool<char>.Shared.Rent(length)); 232ArrayPool<char>.Shared.Return(propertyArray); 247(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 255ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (28)
123propertyArray = ArrayPool<char>.Shared.Rent(length); 139ArrayPool<char>.Shared.Return(propertyArray); 282propertyArray = ArrayPool<byte>.Shared.Rent(length); 298ArrayPool<byte>.Shared.Return(propertyArray); 905(valueArray = ArrayPool<byte>.Shared.Rent(length)); 913ArrayPool<byte>.Shared.Return(valueArray); 928(valueArray = ArrayPool<char>.Shared.Rent(length)); 936ArrayPool<char>.Shared.Return(valueArray); 951(propertyArray = ArrayPool<char>.Shared.Rent(length)); 959ArrayPool<char>.Shared.Return(propertyArray); 974(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 982ArrayPool<byte>.Shared.Return(propertyArray); 1077valueArray = ArrayPool<char>.Shared.Rent(length); 1097propertyArray = ArrayPool<char>.Shared.Rent(length); 1113ArrayPool<char>.Shared.Return(valueArray); 1118ArrayPool<char>.Shared.Return(propertyArray); 1137valueArray = ArrayPool<byte>.Shared.Rent(length); 1157propertyArray = ArrayPool<byte>.Shared.Rent(length); 1173ArrayPool<byte>.Shared.Return(valueArray); 1178ArrayPool<byte>.Shared.Return(propertyArray); 1197valueArray = ArrayPool<byte>.Shared.Rent(length); 1217propertyArray = ArrayPool<char>.Shared.Rent(length); 1233ArrayPool<byte>.Shared.Return(valueArray); 1238ArrayPool<char>.Shared.Return(propertyArray); 1257valueArray = ArrayPool<char>.Shared.Rent(length); 1277propertyArray = ArrayPool<byte>.Shared.Rent(length); 1293ArrayPool<char>.Shared.Return(valueArray); 1298ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.UnsignedNumber.cs (4)
233(propertyArray = ArrayPool<char>.Shared.Rent(length)); 241ArrayPool<char>.Shared.Return(propertyArray); 256(propertyArray = ArrayPool<byte>.Shared.Rent(length)); 264ArrayPool<byte>.Shared.Return(propertyArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.Raw.cs (2)
207json.Length <= (JsonConstants.ArrayPoolMaxSizeBeforeUsingNormalAlloc / JsonConstants.MaxExpansionFactorWhileTranscoding) ? tempArray = ArrayPool<byte>.Shared.Rent(json.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) : 223ArrayPool<byte>.Shared.Return(tempArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.String.cs (4)
192(valueArray = ArrayPool<char>.Shared.Rent(length)); 204ArrayPool<char>.Shared.Return(valueArray); 343(valueArray = ArrayPool<byte>.Shared.Rent(length)); 351ArrayPool<byte>.Shared.Return(valueArray);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (4)
144(valueArray = ArrayPool<char>.Shared.Rent(length)); 160ArrayPool<char>.Shared.Return(valueArray); 310(valueArray = ArrayPool<byte>.Shared.Rent(length)); 326ArrayPool<byte>.Shared.Return(valueArray);
System.Text.Json.SourceGeneration (7)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (4)
48: (rentedBuffer = ArrayPool<char>.Shared.Rent(initialBufferLength)); 169ArrayPool<char>.Shared.Return(rentedBuffer); 188char[] newBuffer = ArrayPool<char>.Shared.Rent(newSize); 194ArrayPool<char>.Shared.Return(rentedBuffer);
System.Text.RegularExpressions (13)
src\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Text\RegularExpressions\Symbolic\MintermClassifier.cs (2)
53object[] arrayPoolArray = ArrayPool<object>.Shared.Rent(minterms.Length); 77ArrayPool<object>.Shared.Return(arrayPoolArray);
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\runtime\src\libraries\Common\src\System\Collections\Generic\ValueListBuilder.cs (3)
186ArrayPool<T>.Shared.Return(toReturn); 228T[] array = ArrayPool<T>.Shared.Rent(nextCapacity); 250ArrayPool<T>.Shared.Return(toReturn);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System.Web.HttpUtility (8)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (4)
29_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity); 265char[] poolArray = ArrayPool<char>.Shared.Rent(newCapacity); 273ArrayPool<char>.Shared.Return(toReturn); 284ArrayPool<char>.Shared.Return(toReturn);
System\Web\Util\HttpEncoder.cs (4)
570byte[] bytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(toEncode.Length)); 572char[] chars = ArrayPool<char>.Shared.Rent(utf8Length * 3); 588ArrayPool<byte>.Shared.Return(bytes); 593ArrayPool<char>.Shared.Return(chars);