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
Fields
Invalid
public static readonly MemoryHandle Invalid
Field Value
Properties
Generation
The generation of the allocation.
public int Generation { get; }
Property Value
ID
The id of the allocation.
public int ID { get; }
Property Value
IsInvalid
public bool IsInvalid { get; }
Property Value
IsValid
public bool IsValid { get; }
Property Value
Methods
Create(void*, nuint)
Creates a new memory handle for the specified memory allocation.
public static MemoryHandle Create(void* address, nuint size)
Parameters
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
otherMemoryHandleAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
newAddressvoid*The new address of the memory allocation.
newSizenuintThe new size of the memory allocation.
Operators
operator ==(MemoryHandle, MemoryHandle)
public static bool operator ==(MemoryHandle left, MemoryHandle right)
Parameters
leftMemoryHandlerightMemoryHandle
Returns
operator !=(MemoryHandle, MemoryHandle)
public static bool operator !=(MemoryHandle left, MemoryHandle right)
Parameters
leftMemoryHandlerightMemoryHandle