<PackageReference Include="System.Memory" Version="4.6.0" />

MemoryPool<T>

public abstract class MemoryPool<T> : IDisposable
Represents a pool of memory blocks.
public static MemoryPool<T> Shared { get; }

Returns a singleton instance of a MemoryPool based on arrays.

public abstract int MaxBufferSize { get; }

Returns the maximum buffer size supported by this pool.

protected MemoryPool()

Constructs a new instance of a memory pool.

public void Dispose()

Frees all resources used by the memory pool.

protected abstract void Dispose(bool disposing)

Frees all resources used by the memory pool.

public abstract IMemoryOwner<T> Rent(int minBufferSize = -1)

Returns a memory block capable of holding at least minBufferSize elements of T.