My program OutOfMemoryExcetiononly generates in Release mode, compiling the VS2010 C # compiler. The operation performed when a failure occurred created 1600 arrays with notches, and it was interrupted when the 207th simplified version of the loop is lower:
Double[][] arr = new Double[1600][];
int i = 0;
while (i < 1600)
{
arr[i] = new Double[1000000];
i++;
}
Basically, only this part of the code will generate ~ 11.9 GB, given that Double consumes 8 bytes. I donβt have that much RAM, but in another question, where I asked what happens when the RAM is exceeded , they answered me that the CLR creates swap memory, although it can only address a certain amount of memory.
When I compile my program in DEBUG mode, it does not quit OutOfMemoryException, instead it allocates a lot of memory and supports the program ... I did not have the patience to check if the program will work slowly, albeit slowly, to the end, because he is too long.
So:
- What happened in Release mode, which was not in debug mode, causing the program to select Exception there?
- Given that I really need to store this amount of memory, because it is data obtained by some scientific calculations, what are your tips for solving this problem? (I consider processing the generated data during the calculations, although the calculations themselves will take a little longer, instead of generating a lot of data and then processing them ...)