#include <ObjectPool.h>
◆ FObject
◆ FPtr
◆ TObjectPool() [1/4]
◆ ~TObjectPool()
◆ TObjectPool() [2/4]
◆ TObjectPool() [3/4]
◆ TObjectPool() [4/4]
◆ Alloc()
template<typename... TArgs>
Allocate an object from the pool Returns an instance of the object type specified for this pool, either from the next available on the final block, the free list or by allocating a new block to continue providing objects. As this method may defer to the runtime allocator it may sometimes run significantly slower when the pool is exhausted Requires that the object is default constructible
- Parameters
-
| Args | - ObjectType constructor arguments |
- Returns
- The newly allocated object
◆ Free()
Free a single object provided by this pool Takes an object previously allocated in this pool and frees it, accessing the pointer beyond a call to free is an undefined operation and could return garbage or an entirely different object. Avoiding this case is the responsibility of the caller Behavior is also undefined if an object not owned by this pool is passed to Free. Outside of debug this will not be asserted
- Parameters
-
◆ GetAllocatedSize()
Get the allocated (total) size of all blocks in the pool
◆ GetCapacity()
Gets the total number of items the pool can currently stor
- Returns
- The pool capacity
◆ GetNumAllocated()
Get the number of allocated items.
◆ GetNumAllocatedBlocks()
Get the number of blocks currently allocated in the pool
◆ GetNumFree()
Gets the number of free items the pool has remaining
- Returns
- Number of free items
◆ GetNumPerBlock()
Get the max number of items per block
◆ GetRatio()
Calculates the storage/overhead ratio of the pool. Larger items that have a size close to the alignment boundary will be more efficient on space
- Returns
- Ratio of storage to overhead
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ReserveBlocks()
Makes sure the pool has at least NumBlocks blocks allocated Note: This will never reduce the number of blocks, it will only make sure the pool has at least NumBlocks block allocated, empty or not.
- Parameters
-
| NumBlocks | - Number of blocks to reserve |
◆ ReserveItems()
Makes sure the pool has at least enough blocks allocated to store NumItems Not: This isn't a number of free items, but total items. If a pool has 100 items in it and ReserveItems(100); is called - no action will be taken. This function will also never remove blocks from the pool - only ever increase. To reduce the number of blocks see ShrinkTo
- See also
- ShrinkTo @Param NumItems - Number of items to reserve
◆ Reset()
Reset the whole pool This will invalidate every currently live object from the pool. If a pointer from this pool is dereferenced beyond a call to Reset then it may return garbage, or point to an entirely different object. Avoiding this case is the responsibility of the caller.
◆ ShrinkTo()
Shrinks the number of blocks All blocks that are not empty are kept, plus a number of empty blocks specified by the caller Passing zero will remove all empty blocks, leaving any non-empty blocks behind
- Parameters
-
| NumDesiredEmptyBlocks | - number of empty blocks to keep |
◆ ItemAlign
The documentation for this class was generated from the following file:
- Engine/Source/Runtime/Experimental/ChaosCore/Public/Chaos/ObjectPool.h