DataShardPool manages a pool of DataShardObject for efficient memory usage.
It pre-allocates shards and reuses them instead of creating/destroying them.
This reduces memory fragmentation and improves performance by avoiding frequent allocations.
The pool is initialized with a configurable size and can grow dynamically if needed.
When shards are no longer needed, they are returned to the pool instead of being destroyed.
More...
#include <DataShardPool.h>
Inherits UObject.
DataShardPool manages a pool of DataShardObject for efficient memory usage.
It pre-allocates shards and reuses them instead of creating/destroying them.
This reduces memory fragmentation and improves performance by avoiding frequent allocations.
The pool is initialized with a configurable size and can grow dynamically if needed.
When shards are no longer needed, they are returned to the pool instead of being destroyed.
◆ GetActiveShardCount()
| int32 DataShardPool::GetActiveShardCount |
( |
| ) |
const |
|
inline |
Returns the number of currently active shards
◆ GetAvailableShardCount()
| int32 DataShardPool::GetAvailableShardCount |
( |
| ) |
const |
|
inline |
Returns the number of available shards in the pool
◆ GetPoolSize()
| int32 DataShardPool::GetPoolSize |
( |
| ) |
const |
|
inline |
Returns the total size of the pool
◆ InitializePool()
| void DataShardPool::InitializePool |
( |
const int32 & | InitialSize = 100 | ) |
|
Initializes the shard pool with a specified number of pre-allocated shards.
- Parameters
-
| InitialSize | - Number of shards to pre-allocate (default: 100) |
◆ RequestShard()
| UDataShardObject * DataShardPool::RequestShard |
( |
const FProperty * | InDataType, |
|
|
int32 & | OutID ) |
Requests a shard from the pool. If the pool is empty, creates a new shard.
- Returns
- A DataShard object ready for use
◆ ReturnShard()
| void DataShardPool::ReturnShard |
( |
UDataShardObject * | Shard | ) |
|
Returns a shard to the pool for reuse. The shard is reset before being added back to the pool.
- Parameters
-
| Shard | - The shard to return to the pool |
◆ ShutdownPool()
| void DataShardPool::ShutdownPool |
( |
| ) |
|
Cleans up the pool and all its shards. Called when the subsystem is deinitialized.
◆ UDataShardPool()
| DataShardPool::UDataShardPool |
( |
| ) |
|