I'm computing some values and stocking them in a variable using a function like what is below:
array<array<double,1000>,1000> index;
sum(double A, ..., array<array<double, 1000>,1000> & index);
I make a quick watch on the index array of array and it's filled with values just in the execution of the above declaration. It's OK
But! As soon as I call another function in which I use the index array, whose declaration is as follow:
average(..., array<array<double,1000>,1000> index, ...)
I'm getting an Unhandled exception (Stack Overflow) which redirects me to an asm file (chkstk.asm):
test dword ptr [eax],eax ; probe page.
Any idea how to resolve this?
By default each thread in Win32 has 1 MB of stack space, and a million doubles would take up 8 MB of stack space. The solution is to allocate them from the heap using new
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With