ThreadSafeFreeList
Engine/source/platform/threads/threadSafeFreeList.h
Freelist for re-using allocations in a concurrent setting.
Public Functions
ThreadSafeFreeList(U32 numPreAlloc)
Create the freelist.
Detailed Description
Freelist for re-using allocations in a concurrent setting.
note:Make sure that there are no more allocations in use when the free list is destructed.
note:Parameters:Allocated instances come with a reference already counted on the instance.
T | Type of elements to allocate; must be derived from ThreadSafeRefCount and have at least define one additional pointer-sized field. |
Protected Attributes
T * mFreeList
Protected Functions
getNext(T * ptr)
Public Functions
ThreadSafeFreeList(U32 numPreAlloc)
Create the freelist.
Parameters:
numPreAlloc | Number of instances to pre-allocate. |
~ThreadSafeFreeList()
alloc()
Return memory for a new instance.
dumpDebug()
free(void * ptr)
Return the memory allocated to the given instance to the freelist.