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