26 instantiations of PinnedBlockMemoryPool
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Internal\PinnedBlockMemoryPoolFactory.cs (1)
30var pool = new PinnedBlockMemoryPool(_meterFactory, _logger);
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
49var pool = new PinnedBlockMemoryPool(_meterFactory, _logger);
src\Shared\Buffers.MemoryPool\MemoryPoolFactory.cs (1)
24return new PinnedBlockMemoryPool(meterFactory);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (21)
ConcurrentPipeWriterTests.cs (5)
20using (var memoryPool = new PinnedBlockMemoryPool()) 83using (var memoryPool = new PinnedBlockMemoryPool()) 181using (var memoryPool = new PinnedBlockMemoryPool()) 265using (var memoryPool = new PinnedBlockMemoryPool()) 333using (var memoryPool = new PinnedBlockMemoryPool())
DiagnosticMemoryPoolTests.cs (4)
15protected override MemoryPool<byte> CreatePool() => new DiagnosticMemoryPool(new PinnedBlockMemoryPool()); 180var memoryPool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(), allowLateReturn: true); 190var memoryPool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(), allowLateReturn: true); 206var memoryPool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(), rentTracking: true);
PinnedBlockMemoryPoolTests.cs (12)
15protected override MemoryPool<byte> CreatePool() => new PinnedBlockMemoryPool(); 36using var memoryPool = new PinnedBlockMemoryPool(); 53using var memoryPool = new PinnedBlockMemoryPool(); 99using var memoryPool = new PinnedBlockMemoryPool(); 133using var memoryPool = new PinnedBlockMemoryPool(); 177using var memoryPool = new PinnedBlockMemoryPool(); 236var pool = new PinnedBlockMemoryPool(testMeterFactory); 272var pool = new PinnedBlockMemoryPool(testMeterFactory); 295var pool = new PinnedBlockMemoryPool(testMeterFactory); 320var pool = new PinnedBlockMemoryPool(testMeterFactory); 357var pool1 = new PinnedBlockMemoryPool(testMeterFactory); 358var pool2 = new PinnedBlockMemoryPool(testMeterFactory);
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\DiagnosticMemoryPoolFactory.cs (1)
32var pool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(), _allowLateReturn, _rentTracking);
Sockets.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\DiagnosticMemoryPoolFactory.cs (1)
32var pool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(), _allowLateReturn, _rentTracking);
46 references to PinnedBlockMemoryPool
Microsoft.AspNetCore.Server.Kestrel.Core (12)
Internal\PinnedBlockMemoryPoolFactory.cs (3)
19private readonly ConcurrentDictionary<PinnedBlockMemoryPool, nuint> _pools = new(); 30var pool = new PinnedBlockMemoryPool(_meterFactory, _logger); 36((ConcurrentDictionary<PinnedBlockMemoryPool, nuint>)state!).TryRemove(self, out _);
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (5)
18private readonly ConcurrentDictionary<PinnedBlockMemoryPool, bool> _pools = new(); 27_timer = new PeriodicTimer(PinnedBlockMemoryPool.DefaultEvictionDelay); 34foreach (var pool in _pools.Keys) 49var pool = new PinnedBlockMemoryPool(_meterFactory, _logger); 55((ConcurrentDictionary<PinnedBlockMemoryPool, bool>)state!).TryRemove(self, out _);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (2)
14internal MemoryPoolBlock(PinnedBlockMemoryPool pool, int length) 26public PinnedBlockMemoryPool Pool { get; }
src\Shared\Buffers.MemoryPool\PinnedBlockMemoryPool.cs (2)
63private Action<object?, PinnedBlockMemoryPool>? _onPoolDisposed; 80public void OnPoolDisposed(Action<object?, PinnedBlockMemoryPool> onPoolDisposed, object? state = null)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (34)
ConcurrentPipeWriterTests.cs (5)
20using (var memoryPool = new PinnedBlockMemoryPool()) 83using (var memoryPool = new PinnedBlockMemoryPool()) 181using (var memoryPool = new PinnedBlockMemoryPool()) 265using (var memoryPool = new PinnedBlockMemoryPool()) 333using (var memoryPool = new PinnedBlockMemoryPool())
PinnedBlockMemoryPoolFactoryTests.cs (7)
21Assert.IsType<PinnedBlockMemoryPool>(pool); 43var dict = (ConcurrentDictionary<PinnedBlockMemoryPool, nuint>)(typeof(PinnedBlockMemoryPoolFactory) 59var pool = Assert.IsType<PinnedBlockMemoryPool>(factory.Create()); 60var pool2 = Assert.IsType<PinnedBlockMemoryPool>(factory.Create()); 95static async Task VerifyPoolEviction(PinnedBlockMemoryPool pool, int previousCount)
PinnedBlockMemoryPoolTests.cs (22)
36using var memoryPool = new PinnedBlockMemoryPool(); 53using var memoryPool = new PinnedBlockMemoryPool(); 99using var memoryPool = new PinnedBlockMemoryPool(); 133using var memoryPool = new PinnedBlockMemoryPool(); 177using var memoryPool = new PinnedBlockMemoryPool(); 236var pool = new PinnedBlockMemoryPool(testMeterFactory); 243Assert.Collection(currentMemoryMetric.GetMeasurementSnapshot(), m => Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value)); 247Assert.Equal(-1 * PinnedBlockMemoryPool.BlockSize, currentMemoryMetric.LastMeasurement.Value); 254Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, currentMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 272var pool = new PinnedBlockMemoryPool(testMeterFactory); 280Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, totalMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 286Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, totalMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 295var pool = new PinnedBlockMemoryPool(testMeterFactory); 304m => Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value), 305m => Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value)); 311Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 320var pool = new PinnedBlockMemoryPool(testMeterFactory); 346Assert.Equal(PinnedBlockMemoryPool.BlockSize, measurement.Value); 357var pool1 = new PinnedBlockMemoryPool(testMeterFactory); 358var pool2 = new PinnedBlockMemoryPool(testMeterFactory); 364Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 373Assert.Equal(4 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter());