Well, relying on one huge array, there are a number of related problems - memory fragmentation, adjacent blocks, limitation on the maximum size of an object, etc. If you need a lot of data, I would recommend creating a class that mimics a large array using a lot of smaller (but still large) arrays, each of which has a fixed size - that is, the index is divided into the search for the corresponding array, and then uses% to get offsets inside this array.
You can also make sure you are on a 64-bit OS with lots of memory. This will give you the maximum available head room.
Depending on the scenario, more complex algorithms such as sparse arrays, eta vectors, etc., may be used to maximize what you can do. You may be surprised at what people could do many years ago with limited memory, and just a tape rotating back and forth ...
source share