Table of Contents

Class MappedMemory<T>

Namespace
DotCompute.Abstractions.Memory
Assembly
DotCompute.Abstractions.dll

Represents a mapped memory region that provides direct access to buffer memory.

public sealed class MappedMemory<T> : IDisposable where T : unmanaged

Type Parameters

T

The element type of the mapped memory.

Inheritance
MappedMemory<T>
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the MappedMemory<T> class.

Constructors

MappedMemory(Memory<T>, Action?)

Represents a mapped memory region that provides direct access to buffer memory.

public MappedMemory(Memory<T> memory, Action? unmapAction = null)

Parameters

memory Memory<T>
unmapAction Action

Remarks

Initializes a new instance of the MappedMemory<T> class.

Properties

Invalid

Creates an invalid mapped memory instance.

[SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "Invalid singleton follows BCL pattern (similar to Array.Empty<T>)")]
public static MappedMemory<T> Invalid { get; }

Property Value

MappedMemory<T>

IsValid

Gets whether this mapped memory is valid.

public bool IsValid { get; }

Property Value

bool

Length

Gets the length of the mapped region in elements.

public int Length { get; }

Property Value

int

Memory

Gets the memory span for the mapped region.

public Memory<T> Memory { get; }

Property Value

Memory<T>

Span

Gets the span for the mapped region.

public Span<T> Span { get; }

Property Value

Span<T>

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Unmap()

Unmaps the memory and releases resources.

public void Unmap()