Daily Unreal Column #72 - TFixedAllocator
We already covered TInlineAllocator in the past, today we will briefly talk about alternative.
As you may remember, TInlineAllocator
allowed us to allocate a memory space for an array elements in the same space as the owner of the array. In case the declaration is inside a function, it is being allocated on stack.
TFixedAllocator
works exactly same in this regard, except it doesn’t offer a fallback which TInlineAllocator
does. This means that if we exceed declared size, the program will crash. This might be intended as we may design certain functions to work on a specific order of magnitude of data, so knowing when this limit is exceeded can be very beneficial to us.
TArray<float, TFixedAllocator<32>> Floats;
The above snippets shows how to declare array using TFixedAllocator
.