Class BufferPool
- 命名空間
- easyar
- 組件
- EasyAR.Sense.dll
BufferPool 實現了一個內存池,可用於自定義攝像頭接入等需要反覆分配相同大小內存的功能,降低內存分配耗時。
public class BufferPool : RefBase, IDisposable
- 繼承
-
BufferPool
- 實作
- 繼承成員
建構函式
BufferPool(int, int)
block_size為每個 `Buffer`_ 的字節大小。 capacity為最大 `Buffer`_ 數量。
public BufferPool(int block_size, int capacity)
參數
block_sizecapacity
方法
Clone()
public BufferPool Clone()
CloneObject()
protected override object CloneObject()
block_size()
每個 `Buffer`_ 的字節大小。
public virtual int block_size()
capacity()
最大 `Buffer`_ 數量。
public virtual int capacity()
size()
當前外部獲得的 `Buffer`_ 數量。
public virtual int size()
tryAcquire()
嘗試獲得內存塊。如果當前外部獲得的 `Buffer`_ 數量沒有達到最大 `Buffer`_ 數量,則取出或分配一個新的 `Buffer`_ ,否則返回空。
public virtual Optional<Buffer> tryAcquire()