Table of Contents

Class MemoryPoolService

Namespace
DotCompute.Runtime.Services
Assembly
DotCompute.Runtime.dll

Production implementation of memory pool service for efficient buffer reuse and management.

public sealed class MemoryPoolService : IMemoryPoolService, IDisposable
Inheritance
MemoryPoolService
Implements
Inherited Members
Extension Methods

Constructors

MemoryPoolService(ILogger<MemoryPoolService>)

Initializes a new instance of the MemoryPoolService class.

public MemoryPoolService(ILogger<MemoryPoolService> logger)

Parameters

logger ILogger<MemoryPoolService>

The logger.

Methods

CreatePoolAsync(string, long, long)

Creates a new memory pool for an accelerator

public Task<IMemoryPool> CreatePoolAsync(string acceleratorId, long initialSize, long maxSize)

Parameters

acceleratorId string

The accelerator identifier

initialSize long

The initial pool size in bytes

maxSize long

The maximum pool size in bytes

Returns

Task<IMemoryPool>

The created memory pool

Dispose()

Performs dispose.

public void Dispose()

GetPool(string)

Gets a memory pool for the specified accelerator

public IMemoryPool GetPool(string acceleratorId)

Parameters

acceleratorId string

The accelerator identifier

Returns

IMemoryPool

The memory pool for the accelerator

GetUsageStatistics()

Gets memory usage statistics across all pools

public MemoryUsageStatistics GetUsageStatistics()

Returns

MemoryUsageStatistics

Memory usage statistics

OptimizeMemoryUsageAsync()

Optimizes memory usage across all pools

public Task OptimizeMemoryUsageAsync()

Returns

Task

A task representing the optimization operation

ReleaseUnusedMemoryAsync()

Releases unused memory from all pools

public Task<long> ReleaseUnusedMemoryAsync()

Returns

Task<long>

The amount of memory released in bytes