Table of Contents

Class MemoryPoolManager

Namespace
Orleans.GpuBridge.Runtime
Assembly
Orleans.GpuBridge.Runtime.dll

Memory pool manager for different types with size limits

public sealed class MemoryPoolManager : IDisposable
Inheritance
MemoryPoolManager
Implements
Inherited Members

Constructors

MemoryPoolManager(ILoggerFactory, MemoryPoolOptions?)

Initializes a new instance of the MemoryPoolManager class.

public MemoryPoolManager(ILoggerFactory loggerFactory, MemoryPoolOptions? options = null)

Parameters

loggerFactory ILoggerFactory

The logger factory for creating diagnostic loggers.

options MemoryPoolOptions

Optional memory pool configuration options.

Methods

Dispose()

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

public void Dispose()

GetAllStats()

Gets statistics for all memory pools.

public Dictionary<Type, MemoryPoolStats> GetAllStats()

Returns

Dictionary<Type, MemoryPoolStats>

A dictionary mapping element types to their pool statistics.

GetHealthStatus()

Gets the current health status of the memory pool system.

public MemoryPoolHealth GetHealthStatus()

Returns

MemoryPoolHealth

The health status information.

GetPool<T>()

Gets or creates a memory pool for the specified element type.

public IGpuMemoryPool<T> GetPool<T>() where T : unmanaged

Returns

IGpuMemoryPool<T>

A memory pool for the specified type.

Type Parameters

T

The unmanaged element type.

ReleaseAllocation(long)

Releases a previously allocated number of bytes back to the pool.

public void ReleaseAllocation(long bytes)

Parameters

bytes long

The number of bytes to release.

TryAllocate(long, out string?)

Attempts to allocate the specified number of bytes from the total memory pool.

public bool TryAllocate(long requestedBytes, out string? reason)

Parameters

requestedBytes long

The number of bytes to allocate.

reason string

If allocation fails, contains the reason for failure.

Returns

bool

True if allocation succeeded; otherwise, false.

UpdateLimits(long)

Updates the total memory limit for all pools.

public void UpdateLimits(long newTotalLimit)

Parameters

newTotalLimit long

The new total memory limit in bytes.