template <typename T, typename PolicyT = DefaultObjectPoolPolicy<T>>

class ObjectPool

Defined at line 52 of file ../../src/ui/lib/escher/util/object_pool.h

An ObjectPool is an allocator for objects of type T. The underlying memory

is allocated in contiguous chunks. The default policy is to construct the

objects as they are allocated (via InitializePoolObject()) and destroy them

as they are freed (via DestroyPoolObject()). However, some objects such as

Vulkan descriptor sets must be allocated in batches. For these cases, the

ObjectPool can be parameterized with a different PolicyT object.

Public Methods

template <typename... Args>
void ObjectPool<T, PolicyT> (Args &&... args)

Defined at line 55 of file ../../src/ui/lib/escher/util/object_pool.h

void ~ObjectPool<T, PolicyT> ()

Defined at line 56 of file ../../src/ui/lib/escher/util/object_pool.h

template <typename... Args>
T * Allocate (Args &&... args)

Allocate an object from the pool, constructing it with the specified

arguments.

Defined at line 61 of file ../../src/ui/lib/escher/util/object_pool.h

void Free (T * ptr)

Free the object, releasing it back to the pool for subsequent re-use.

Defined at line 73 of file ../../src/ui/lib/escher/util/object_pool.h

size_t InitialBlockSize ()

Return the number of objects that can be held in the initial block

allocation.

Defined at line 80 of file ../../src/ui/lib/escher/util/object_pool.h

size_t NumObjectsInBlock (size_t block_index)

Return the number of objects that can be held in the "block_index-th"

allocation.

Defined at line 84 of file ../../src/ui/lib/escher/util/object_pool.h

size_t GetCapacity ()

Total number of objects that can be allocated from the pool without

changing the amount of underlying memory.

Defined at line 88 of file ../../src/ui/lib/escher/util/object_pool.h

size_t UnfreedObjectCount ()

Return the number of objects that have been allocated but not freed.

Defined at line 98 of file ../../src/ui/lib/escher/util/object_pool.h

void Clear ()

Release all pool resources. Illegal to call while there are still unfreed

objects. ObjectPool only releases memory when Clear() is called.

Defined at line 102 of file ../../src/ui/lib/escher/util/object_pool.h

const PolicyType & policy ()

Defined at line 116 of file ../../src/ui/lib/escher/util/object_pool.h