ByteMemoryPool

Ecng.ComponentModel

Thread-safe memory pool for reusing Memory memories of specific sizes.

継承元: MemoryPool<byte>

コンストラクター

ByteMemoryPool
public ByteMemoryPool(int maxBufferSize)
byteMemoryPool = ByteMemoryPool(maxBufferSize)

Initializes a new instance of the ByteMemoryPool class with the specified maximum buffer size.

maxBufferSize
The maximum size of the buffer that can be rented from the pool.

プロパティ

DefaultSize
public int DefaultSize { get; set; }
value = byteMemoryPool.DefaultSize
byteMemoryPool.DefaultSize = value

The default size of the memory to rent when no specific size is requested.

MaxBufferSize
public override int MaxBufferSize { get; }
value = byteMemoryPool.MaxBufferSize
MaxCount
public int MaxCount { get; set; }
value = byteMemoryPool.MaxCount
byteMemoryPool.MaxCount = value

Gets or sets the maximum number of memories to store for each size.

MaxPerLength
public int MaxPerLength { get; set; }
value = byteMemoryPool.MaxPerLength
byteMemoryPool.MaxPerLength = value

Gets or sets the maximum number of memories to store for each size.

TotalBytes
public long TotalBytes { get; }
value = byteMemoryPool.TotalBytes

Gets the total number of bytes currently stored in the pool across all sizes.

TotalCount
public int TotalCount { get; }
value = byteMemoryPool.TotalCount

Gets the total number of memories currently stored in the pool across all sizes.

メソッド

Clear
public void Clear()
byteMemoryPool.Clear()

Clears the pool, removing all stored memories.

Dispose
protected override void Dispose(bool disposing)
byteMemoryPool.Dispose(disposing)

Disposes the command resources.

disposing
True if disposing managed resources.
Rent
public override IMemoryOwner<byte> Rent(int minBufferSize)
result = byteMemoryPool.Rent(minBufferSize)

イベント

LimitExceed
public event Action<LimitTypes> LimitExceed
byteMemoryPool.LimitExceed += handler

Occurs when the pool cannot cache more buffers due to reaching a limit.