I've written a rather hefty algorithm that requires storing very large arrays, and I believe it's making my code crash. I get the following errors:
"ViscousBurgers.exe has stopped working"
"Process returned -1073741571 <0xC00000FD> execution time : 38.529 s"
I've checked my code and I can't find anything that would cause it to crash like so, and when I run a coarser grid, the program seems to run fine. So my best guess is that this is a memory issue. I'm not sure how else to handle this as I have to store these two arrays. Do you guys have any suggestions as to how to overcome this?
I'm running Windows 7 64-bit with 16 gigs of ram, if that's of any help. Here is my code for reference:
Lines 40, 49 and 50 are not legal C++. N is not a true compile-time constant, so it can't be used to specify an array size. You're probably using a vla extension.
Have you tried moving the declarations for x, y, t, U and V outside the main() function so that they aren't allocated on the stack? It's possible the stack just isn't big enough to hold them.
Stuff defined in a function is allocated on the stack. Stuff defined at global or file scope is not (typically it resides in a data segment separate from the stack and heap.)
For large arrays that you don't want to be visible in so broad a scope using dynamically allocated memory obtained via new may be a good choice.