Can Dynamic 2D arrays solve stack overflow problem?
-
Hi, I wrote a piece of code which initially uses a 128 by 47 2D array. It works fine. But when I changed it to 1600 rows by 47 columns, the program starts to crash. The error message said that a stack overflow has occured. I would like to know if dynamic 2D arrays solve this problem? There are also some 1D arrays with the size of 1600. Do they have to be converted to dynamic arrays too?
-
Hi, I wrote a piece of code which initially uses a 128 by 47 2D array. It works fine. But when I changed it to 1600 rows by 47 columns, the program starts to crash. The error message said that a stack overflow has occured. I would like to know if dynamic 2D arrays solve this problem? There are also some 1D arrays with the size of 1600. Do they have to be converted to dynamic arrays too?
Wouldn't it be easier to use a vector?
-
Hi, I wrote a piece of code which initially uses a 128 by 47 2D array. It works fine. But when I changed it to 1600 rows by 47 columns, the program starts to crash. The error message said that a stack overflow has occured. I would like to know if dynamic 2D arrays solve this problem? There are also some 1D arrays with the size of 1600. Do they have to be converted to dynamic arrays too?
What is the size of the data? an array of what ? dynamic arrays might or might not fix your problem if it's a size issue.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
Hi, I wrote a piece of code which initially uses a 128 by 47 2D array. It works fine. But when I changed it to 1600 rows by 47 columns, the program starts to crash. The error message said that a stack overflow has occured. I would like to know if dynamic 2D arrays solve this problem? There are also some 1D arrays with the size of 1600. Do they have to be converted to dynamic arrays too?
75,200
int
s would require 300,800 bytes of stack. If that were adouble
, it would require 601,600 bytes of stack, over half of the default value. Pass that around to only a few functions and the stack could be exhausted very easily.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb