Download

Any disadvantages of having empty TArrays?

There would few hundred instances of a structure in my game.

The structure has a TArray which would be empty around 90% of time. I wanted to know if I would face any drawbacks having that many number of empty TArrays. I don’t think an empty TArray consumes any extra memory.

It won’t be an issue, but if you have a lot of them and they sometimes hold a large amount of data, you might want to ensure they don’t maintain their memory allocation when unused. Just removing elements to the point that there are non left won’t necessarily do this. You’d need to call Empty().