There is one solution to this problem, but it leads to (at least) three different follow-on solutions. The solution is "don't use large arrays as local variables, because it blows up the stack".
The solution clearly means changing the code in some way. There are a few different ways to do that.
The obvious and straight-forwards solution is to use std::vector<double>
instead.
Another solution is to use `
unique_ptr<double[]> a = std::unique_ptr<double[]>(new double[150000]);
The third, and SOMETIMES a good solutions, is to make a
and b
global variables.
There are several other variants, but they are generally variations on the same theme, just with slight variations. What is best in your case really depends on what the rest of your code is doing. I'd start with std::vector<double>
, but other alternatives do exist, should that be an unsuitable solution for some reason.