What is the max size of a 3 dimension array?

I tried to make a 3D array 4096by 4096 by 256 and unity seemed to think it was to large, what is the max?

The max is determined by how much memory your computer has. When you make an array, the system allocates memory to store the elements in the array. If your machine doesn’t have enough, it will crash.

Also, keep in mind that the actual max length of the array you can make at any one time is almost never equal to the amount of free memory reported by your OS, because static arrays reserve memory contiguously. So the more fragmented your memory is, the smaller the free “holes” in between allocated chunks are going to be, and thus, the smaller the max size of the array you can allocate.

4096x4096x256 is a completely ridiculous amount anyway, why do you need that much space? Are those textures you’re trying to save or something?

It depends a bit on the data type. I am using Bools for something, i need a 1 or 8 billion byte array. Booleans use 4 bytes of memory each because its the fastest access of the memory even though they could use 2.

bytes themselves use 2 and they are slower than bools although thats to be defined i figure its all .net framework 2 data types and bytes. If you use integers of your 4bn array it will definately crash. its bigger than a boolean array.

I can get a 2bn boolean array its 3gb of ram. 3-4bn makes unity crash in JS, although it could work unchecked in c# code