UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter > Class Template Reference

#include <LockFreeFixedSizeAllocator.h>

Public Member Functions

 TLockFreeFixedSizeAllocator ()
 
 ~TLockFreeFixedSizeAllocator ()
 
voidAllocate (int32 Alignment=MIN_ALIGNMENT)
 
void Free (void *Item)
 
void Trim ()
 
TTrackingCounter::IntegerType GetNumUsed () const
 
TTrackingCounter::IntegerType GetNumFree () const
 

Detailed Description

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
class TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >

Thread safe, lock free pooling allocator of fixed size blocks that only returns free space when the allocator is destroyed. Alignment isn't handled; assumes FMemory::Malloc will work.

Constructor & Destructor Documentation

◆ TLockFreeFixedSizeAllocator()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::TLockFreeFixedSizeAllocator ( )
inline

◆ ~TLockFreeFixedSizeAllocator()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::~TLockFreeFixedSizeAllocator ( )
inline

Destructor, returns all memory via FMemory::Free

Member Function Documentation

◆ Allocate()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
void * TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::Allocate ( int32  Alignment = MIN_ALIGNMENT)
inline

Allocates a memory block of size SIZE.

Returns
Pointer to the allocated memory.
See also
Free

◆ Free()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
void TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::Free ( void Item)
inline

Puts a memory block previously obtained from Allocate() back on the free list for future use.

Parameters
ItemThe item to free.
See also
Allocate

◆ GetNumFree()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
TTrackingCounter::IntegerType TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::GetNumFree ( ) const
inline

Gets the number of allocated memory blocks that are currently unused.

Returns
Number of unused memory blocks.
See also
GetNumUsed

◆ GetNumUsed()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
TTrackingCounter::IntegerType TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::GetNumUsed ( ) const
inline

Gets the number of allocated memory blocks that are currently in use.

Returns
Number of used memory blocks.
See also
GetNumFree

◆ Trim()

template<int32 SIZE, int TPaddingForCacheContention, typename TTrackingCounter = FNoopCounter>
void TLockFreeFixedSizeAllocator< SIZE, TPaddingForCacheContention, TTrackingCounter >::Trim ( )
inline

Returns all free memory to the heap.


The documentation for this class was generated from the following file: