Overview
PointerMemoryManager is a common concept among projects, allowing to pass native memory to async apis that take Memory.
API breakdown
public sealed class PointerMemoryManager<T> : MemoryManager<T>
{
public PointerMemoryManager(T* pointer, int size);
public override Span<T> GetSpan();
public override MemoryHandle Pin(int elementIndex = 0);
public override void Unpin();
protected override void Dispose(bool disposing);
}
Usage example
byte* ptr = SomeApi(out int length);
using PointerMemoryManager<byte> manager = new(ptr, length);
await SomeAsyncApi(manager.Memory);
Breaking change?
No
Alternatives
Define it in your project.
Additional context
No response
Help us help you
No, just wanted to propose this
Overview
PointerMemoryManageris a common concept among projects, allowing to pass native memory to async apis that take Memory.API breakdown
Usage example
Breaking change?
No
Alternatives
Define it in your project.
Additional context
No response
Help us help you
No, just wanted to propose this