Table of Contents

Struct MemoryHandle

Namespace
Misaki.HighPerformance.LowLevel.Buffer
Assembly
Misaki.HighPerformance.LowLevel.dll

A structure that represents a handle to a memory allocation for tracking and management purposes.

public readonly struct MemoryHandle : IDisposable, IEquatable<MemoryHandle>
Implements
Inherited Members

Constructors

MemoryHandle(int, int)

Creates a new instance of the MemoryHandle struct with the specified id and generation.

public MemoryHandle(int id, int generation)

Parameters

id int

The id of the allocation.

generation int

The generation of the allocation.

Fields

Invalid

public static readonly MemoryHandle Invalid

Field Value

MemoryHandle

Properties

Generation

The generation of the allocation.

public int Generation { get; }

Property Value

int

ID

The id of the allocation.

public int ID { get; }

Property Value

int

IsInvalid

public bool IsInvalid { get; }

Property Value

bool

IsValid

public bool IsValid { get; }

Property Value

bool

Methods

Create(void*, nuint)

Creates a new memory handle for the specified memory allocation.

public static MemoryHandle Create(void* address, nuint size)

Parameters

address void*

The address of the memory allocation.

size nuint

The size of the memory allocation.

Returns

MemoryHandle

The created memory handle.

Dispose()

Removes the handle from the tracking system.

public void Dispose()

Remarks

This does not free the associated memory allocation.

Equals(MemoryHandle)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(MemoryHandle other)

Parameters

other MemoryHandle

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string? ToString()

Returns

string

The fully qualified type name.

Update(void*, nuint)

Updates the memory handle with a new address and size.

public void Update(void* newAddress, nuint newSize)

Parameters

newAddress void*

The new address of the memory allocation.

newSize nuint

The new size of the memory allocation.

Operators

operator ==(MemoryHandle, MemoryHandle)

public static bool operator ==(MemoryHandle left, MemoryHandle right)

Parameters

left MemoryHandle
right MemoryHandle

Returns

bool

operator !=(MemoryHandle, MemoryHandle)

public static bool operator !=(MemoryHandle left, MemoryHandle right)

Parameters

left MemoryHandle
right MemoryHandle

Returns

bool