Table of Contents

Interface IMemoryPool

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

Memory pool interface

public interface IMemoryPool : IDisposable
Inherited Members
Extension Methods

Properties

AcceleratorId

Gets the accelerator ID this pool belongs to

string AcceleratorId { get; }

Property Value

string

AvailableSize

Gets the available size in bytes

long AvailableSize { get; }

Property Value

long

TotalSize

Gets the total pool size in bytes

long TotalSize { get; }

Property Value

long

UsedSize

Gets the used size in bytes

long UsedSize { get; }

Property Value

long

Methods

AllocateAsync(long)

Allocates memory from the pool

Task<IUnifiedMemoryBuffer> AllocateAsync(long sizeInBytes)

Parameters

sizeInBytes long

The size to allocate

Returns

Task<IUnifiedMemoryBuffer>

The allocated memory buffer

DefragmentAsync()

Defragments the memory pool

Task DefragmentAsync()

Returns

Task

A task representing the defragmentation operation

GetStatistics()

Gets pool statistics

MemoryPoolStatistics GetStatistics()

Returns

MemoryPoolStatistics

Pool statistics

ReturnAsync(IUnifiedMemoryBuffer)

Returns memory to the pool

Task ReturnAsync(IUnifiedMemoryBuffer buffer)

Parameters

buffer IUnifiedMemoryBuffer

The memory buffer to return

Returns

Task

A task representing the return operation