#include <UObjectAllocator.h>
A pool allocator for Karma's UObjects. I'd higly recommend Gregory's Game Engine Architecture section 5.2 for introductory level and practical approach to memory system.
A modular memory system https://github.com/ravimohan1991/cppGameMemorySystem Karma's take https://github.com/ravimohan1991/KarmaEngine/wiki/Karma-Smriti
◆ FUObjectAllocator()
Karma::FUObjectAllocator::FUObjectAllocator |
( |
| ) |
|
|
inline |
Constructor, initializes to no permanent object pool
◆ AllocatePermanentObjectPool()
void Karma::FUObjectAllocator::AllocatePermanentObjectPool |
( |
int32_t | InPermanentObjectPoolSize | ) |
|
Allocates and initializes the permanent object pool. For legacy purpose.
- Parameters
-
InPermanentObjectPoolSize | size of permanent object pool |
Allocates and initializes the permanent object pool
- Parameters
-
InPermanentObjectPoolSize | size of permanent object pool |
◆ AllocateUObject()
UObjectBase * Karma::FUObjectAllocator::AllocateUObject |
( |
size_t | Size, |
|
|
size_t | Alignment, |
|
|
bool | bAllowPermanent ) |
Allocates a UObjectBase from the free store or the permanent object pool Note: We are returning UObjectBase pointer because ue does so. Else void pointer could have done the job, since what we are returning is not really a UObjectBase.
- Parameters
-
Size | size of uobject to allocate |
Alignment | alignment of uobject to allocate |
bAllowPermanent | if true, allow allocation in the permanent object pool, if it fits |
- Returns
- newly allocated UObjectBase (not really a UObjectBase yet, no constructor like thing has been called).
◆ BootMessage()
void Karma::FUObjectAllocator::BootMessage |
( |
| ) |
|
Prints a debugf message to allow tuning
◆ DumpUObjectsInformation()
void Karma::FUObjectAllocator::DumpUObjectsInformation |
( |
void * | InObject, |
|
|
const std::string & | InName, |
|
|
size_t | InSize, |
|
|
size_t | InAlignment, |
|
|
class UClass * | InClass ) |
A callback based routine for curating statistics of UObjects being allocated
◆ GetAlignedUObjectSize()
uint32_t Karma::FUObjectAllocator::GetAlignedUObjectSize |
( |
| ) |
const |
|
inline |
Get total boundary aligned size of UObject
◆ GetBareUObjectSize()
uint32_t Karma::FUObjectAllocator::GetBareUObjectSize |
( |
| ) |
const |
|
inline |
Get the bare cumulatice size of UObjects
◆ GetNumberOfUObjects()
uint32_t Karma::FUObjectAllocator::GetNumberOfUObjects |
( |
| ) |
const |
|
inline |
Get total number of UObjects
◆ GetPermanentObjectPool()
uint8_t * Karma::FUObjectAllocator::GetPermanentObjectPool |
( |
| ) |
const |
|
inline |
Get the begining of object pool
◆ GetPermanentObjectPoolEnd()
uint8_t * Karma::FUObjectAllocator::GetPermanentObjectPoolEnd |
( |
| ) |
const |
|
inline |
Get the address of memory pool block ending
◆ GetPermanentObjectPoolTail()
uint8_t * Karma::FUObjectAllocator::GetPermanentObjectPoolTail |
( |
| ) |
const |
|
inline |
Returns a UObjectBase to the free store, unless it is in the permanent object pool
- Parameters
-
Object | object to free Get the current position of objectpool tail |
◆ GetPermanentPoolSize()
uint32_t Karma::FUObjectAllocator::GetPermanentPoolSize |
( |
| ) |
const |
|
inline |
Get the total pool size in bytes
◆ Initialize()
void Karma::FUObjectAllocator::Initialize |
( |
uint8_t * | pMemoryStart, |
|
|
size_t | elemetSizeBytes, |
|
|
size_t | numberOfElemets ) |
Initializes the pool allocator with alloted memory variables
- Parameters
-
pMemoryStart | Pointer to the start of the pool memory |
elementSizeBytes | Size of each element in bytes |
numberOfElements | Tota number of UObjects envisoned |
- See also
- KarmaSmriti::StartUp()
◆ ResidesInPermanentPool()
FORCEINLINE bool Karma::FUObjectAllocator::ResidesInPermanentPool |
( |
const UObjectBase * | Object | ) |
const |
|
inline |
Checks whether object is part of permanent object pool.
- Parameters
-
Object | object to test as a member of permanent object pool |
- Returns
- true if object is part of permanent object pool, false otherwise
The documentation for this class was generated from the following files: