Table of Contents

Class BufferPool

Namespace
easyar
Assembly
EasyAR.Sense.dll

BufferPool implements a memory pool. It can be used for features that repeatedly allocate memory of the same size, such as custom camera access, reducing time spent on memory allocation.

public class BufferPool : RefBase, IDisposable
Inheritance
BufferPool
Implements
Inherited Members

Constructors

BufferPool(int, int)

block_size is the byte size of each `Buffer`_. capacity is the maximum number of `Buffer`_ objects.

public BufferPool(int block_size, int capacity)

Parameters

block_size
capacity

Methods

Clone()

public BufferPool Clone()

block_size()

Byte size of each `Buffer`_.

public virtual int block_size()

capacity()

Maximum number of `Buffer`_ objects.

public virtual int capacity()

size()

Current number of `Buffer`_ objects obtained externally.

public virtual int size()

tryAcquire()

Tries to obtain a memory block. If the current number of externally obtained `Buffer`_ objects has not reached the maximum number of `Buffer`_ objects, it retrieves or allocates a new `Buffer`_; otherwise, it returns empty.

public virtual Optional<Buffer> tryAcquire()