Table of Contents

Class BasePooledBuffer<T>

Namespace
DotCompute.Memory
Assembly
DotCompute.Memory.dll

Base class for pooled memory buffers with automatic recycling.

public abstract class BasePooledBuffer<T> : BaseMemoryBuffer<T>, IUnifiedMemoryBuffer<T>, IUnifiedMemoryBuffer, IAsyncDisposable, IMemoryOwner<T>, IDisposable where T : unmanaged

Type Parameters

T
Inheritance
BasePooledBuffer<T>
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the BasePooledBuffer<T> class.

Constructors

BasePooledBuffer(long, Action<BasePooledBuffer<T>>?)

Base class for pooled memory buffers with automatic recycling.

protected BasePooledBuffer(long sizeInBytes, Action<BasePooledBuffer<T>>? returnAction = null)

Parameters

sizeInBytes long
returnAction Action<BasePooledBuffer<T>>

Remarks

Initializes a new instance of the BasePooledBuffer<T> class.

Properties

IsDisposed

Gets whether the buffer has been disposed.

public override bool IsDisposed { get; }

Property Value

bool

Memory

Gets the memory belonging to this owner.

public abstract Memory<T> Memory { get; }

Property Value

Memory<T>

The memory belonging to this owner.

Methods

Dispose()

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

public override void Dispose()

DisposeAsync()

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

public override ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

DisposeCore()

Core disposal logic to be implemented by derived classes.

protected virtual void DisposeCore()

DisposeCoreAsync()

Core async disposal logic to be implemented by derived classes.

protected virtual ValueTask DisposeCoreAsync()

Returns

ValueTask

Reset()

Resets the buffer for reuse in the pool.

public virtual void Reset()