Download

TInlineAllocator can't be Uproperty() so my array is garbage collected ?

Dear all,

In a prototype i’m building I use an array of type:

TArray<UFZ_Cell*, TInlineAllocator<100000>> Cells;

The TInlineAllocator keyword allows me to create these cells on the stack (in an attempt to improve performance). The problem is that my array is being garbage collected because i can’t make stack allocated TArray’s UPROPERTY(). This also goes for TFixedAllocator. How can i manage this?

Thanks a million! :rolleyes:

Move information on stack allocated TArray’s:
https://www.unrealengine.com/en-US/b…or-performance

Did you try something like, maybe:



TStaticArray< TSharedPtr<UFZ_Cell>, TInlineAllocator<100000> > Cells;


?

Euhm that doesn’t seem to compile:

error C2993: ‘TInlineAllocator<100000,FDefaultAllocator>’: illegal type for non-type template parameter ‘NumElements’

Would that allow me to make it UPROPERTY()? Or would that prevent garbage collection from throwing away my data?