I'm trying to initialize a jagged array of 120 000 x 4600 for a data mining algorithm but I have an OutOfMemoryException exception
double[][] array = new double[120000][];
for (int i = 0; i < array.Length; i++)
{
array[i] = new double[4600];
}
it throws when i is around 49 000
I know .Net is limited to 2GB per object, but I thought that the array here would be a list of addresses to an array of double. So it wouldn't be a big single object.
I thought that's why Jon Skeet suggests an jagged array for this question OutOfMemoryException on declaration of Large Array
I don't think that I understand his answer.
Is it one big object and if it's not why does it throw an exception.
Thank you
double) is 1,803,200,000 bytes. And you don't know why it throwsOutOfMemoryException?[,], by making a jagged array with[][]it is one array of120000references and120000arrays that are4600 * 8bytes large. Marc, you are correct, the commenters are wrong.