ByteMemoryPool
Ecng.ComponentModel
Thread-safe memory pool for reusing Memory memories of specific sizes.
Hereda de: MemoryPool<byte>
Constructores
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.
Propiedades
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.
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.
Métodos
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)
Eventos
LimitExceed
public event Action<LimitTypes> LimitExceed
byteMemoryPool.LimitExceed += handler
Occurs when the pool cannot cache more buffers due to reaching a limit.