what are the limits of arrays?

So, how exactly do I find out how big I can make my arrays?

Do other big arrays have to make my other arrays be smaller?

Does this simply take more GB’s of ram in a computer, or are there key bottlenecks to look out for?

I’d like to at least be able to predict if my array will be too big rather than just testing to see if it crashes.

over 2 billion for boolean, it depends how much every element takes in bytes. 2.47 billion is the upper limit of integers in c#.

Arrays can be huge. They’re the structure that Unity uses to store the vertices and triangles of every mesh in the scene, for example. What matters, performance-wise, is how you access the members of that array. You don’t want to be iterating over all the members of a million-element array in a for loop or resorting that array every frame, for example.

Whatever bottlenecks you may have in your game, using arrays to store data is never going to be one of them.

Hmmm 2016 Q. But here we Go.


2d array Example: (Variable memory allocation) + (array reference information).

(xy variable size) + (xy 4 x bytes) = 25 bytes + 100 bytes = 125 bytes if it was 5x5 byte array.


{I’m just using basic thought here. I didn’t look up the values}. The same logic counts for any kind of dimensional array that uses a fixed size variable, like say a bool or Vector3 or int or etc.

So in short. How much Memory you got to work with. {Edit: Forgot the ← actual Answer}.

Good Luck.

(Edit: Simplified Stuff)