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

MemoryManager<T>

public abstract class MemoryManager<T> : IMemoryOwner<T>, IDisposable, IPinnable
Manager of Memory<T> that provides the implementation.
public virtual Memory<T> Memory { get; }

Returns a Memory<T>.

protected MemoryManager()

protected Memory<T> CreateMemory(int length)

Returns a Memory<T> for the current MemoryManager<T>.

protected Memory<T> CreateMemory(int start, int length)

Returns a Memory<T> for the current MemoryManager<T>.

protected abstract void Dispose(bool disposing)

Clean up of any leftover managed and unmanaged resources.

public abstract Span<T> GetSpan()

Returns a span wrapping the underlying memory.

public abstract MemoryHandle Pin(int elementIndex = 0)

Returns a handle to the memory that has been pinned and hence its address can be taken.

public abstract void Unpin()

Lets the garbage collector know that the object is free to be moved now.