Stack overflow
-
I am using a two dimensional array to read the image data.If i increase the indexes to large value >500 i am getting Unhandled exception:stack overflow.How to overcome this problem. Regards
Some code and more detailed informations would be welcome.
Cédric Moonen Software developer
Charting control [v1.2] -
I am using a two dimensional array to read the image data.If i increase the indexes to large value >500 i am getting Unhandled exception:stack overflow.How to overcome this problem. Regards
Firstly, show some details or you have little hope of getting help. I would guess you're storing the array on the stack; if it's a really big array the heap is the correct choice. Let’s do some calculations. Assume a 2D array of
int
s with each dimension set to 500. The space required is:sizeof(int)
*500*500 = 4*500*500 = 1,000,000. That’s nearly a megabyte on the stack! The default stack size used by the linker is 1 MB. If I’m correct nearly all your stack is being used by one variable!Steve