21 instantiations of PinnedBlockMemoryPool
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Internal\PinnedBlockMemoryPoolFactory.cs (1)
29var pool = new PinnedBlockMemoryPool(options?.Owner, _metrics, _logger);
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
49var pool = new PinnedBlockMemoryPool(options?.Owner, _metrics, _logger);
src\Shared\Buffers.MemoryPool\MemoryPoolFactory.cs (1)
24return new PinnedBlockMemoryPool(owner: owner, metrics: meterFactory != null ? new MemoryPoolMetrics(meterFactory) : null);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (16)
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 (7)
16protected override MemoryPool<byte> CreatePool() => new PinnedBlockMemoryPool(); 37using var memoryPool = new PinnedBlockMemoryPool(); 54using var memoryPool = new PinnedBlockMemoryPool(); 100using var memoryPool = new PinnedBlockMemoryPool(); 134using var memoryPool = new PinnedBlockMemoryPool(); 178using var memoryPool = new PinnedBlockMemoryPool(); 437return new PinnedBlockMemoryPool(owner: owner, metrics: new MemoryPoolMetrics(meterFactory));
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\DiagnosticMemoryPoolFactory.cs (1)
32var pool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(options?.Owner), _allowLateReturn, _rentTracking);
Sockets.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\DiagnosticMemoryPoolFactory.cs (1)
32var pool = new DiagnosticMemoryPool(new PinnedBlockMemoryPool(options?.Owner), _allowLateReturn, _rentTracking);
55 references to PinnedBlockMemoryPool
Microsoft.AspNetCore.Server.Kestrel.Core (12)
Internal\PinnedBlockMemoryPoolFactory.cs (3)
18private readonly ConcurrentDictionary<PinnedBlockMemoryPool, nuint> _pools = new(); 29var pool = new PinnedBlockMemoryPool(options?.Owner, _metrics, _logger); 35((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(options?.Owner, _metrics, _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)
62private Action<object?, PinnedBlockMemoryPool>? _onPoolDisposed; 83public void OnPoolDisposed(Action<object?, PinnedBlockMemoryPool> onPoolDisposed, object? state = null)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (43)
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 (9)
22Assert.IsType<PinnedBlockMemoryPool>(pool); 23Assert.Null(Assert.IsType<PinnedBlockMemoryPool>(pool).Owner); 32Assert.Equal("test", Assert.IsType<PinnedBlockMemoryPool>(pool).Owner); 54var dict = (ConcurrentDictionary<PinnedBlockMemoryPool, nuint>)(typeof(PinnedBlockMemoryPoolFactory) 70var pool = Assert.IsType<PinnedBlockMemoryPool>(factory.Create()); 71var pool2 = Assert.IsType<PinnedBlockMemoryPool>(factory.Create()); 106static async Task VerifyPoolEviction(PinnedBlockMemoryPool pool, int previousCount)
PinnedBlockMemoryPoolTests.cs (29)
37using var memoryPool = new PinnedBlockMemoryPool(); 54using var memoryPool = new PinnedBlockMemoryPool(); 100using var memoryPool = new PinnedBlockMemoryPool(); 134using var memoryPool = new PinnedBlockMemoryPool(); 178using var memoryPool = new PinnedBlockMemoryPool(); 237var pool = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 247Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 253Assert.Equal(-1 * PinnedBlockMemoryPool.BlockSize, currentMemoryMetric.LastMeasurement.Value); 260Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, currentMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 278var pool = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 288Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 293Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 298Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, totalMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 304Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, totalMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 313var pool = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 324Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 329Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 337Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 346var pool = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 372Assert.Equal(PinnedBlockMemoryPool.BlockSize, measurement.Value); 384var pool1 = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 385var pool2 = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory); 391Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 400Assert.Equal(4 * PinnedBlockMemoryPool.BlockSize, rentMetric.GetMeasurementSnapshot().EvaluateAsCounter()); 412var pool1 = CreateMemoryPool(owner: "test1", meterFactory: testMeterFactory); 413var pool2 = CreateMemoryPool(owner: "test2", meterFactory: testMeterFactory); 422Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 427Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value); 435private static PinnedBlockMemoryPool CreateMemoryPool(string owner, TestMeterFactory meterFactory)