Hi,
I have a recursion in my application and very rearly it throws StackOverFlowException, but it happens and I have to solve it somehow. Here's my method:
private double GeneratePHybridValue(DataRow row)
{
double p_hybrid_value = 0.0;
double min_value;
double max_value;
double old_M = (double)row["M"];
double old_G = (double)row["G"];
double old_H = (double)row["H"];
min_value = Math.Min(Math.Min((double)row["M"], (double)row["G"]), (double)row["H"]);
max_value = Math.Max(Math.Max((double)row["M"], (double)row["G"]), (double)row["H"]);
if ((max_value - min_value) < 0.01)
{
p_hybrid_value = (min_value + max_value) / 2.0;
}
else
{
row["M"] = ArithmeticMean(old_M, old_G, old_H);
row["G"] = GeometricMean(old_M, old_G, old_H);
row["H"] = HarmonicMean(old_M, old_G, old_H);
p_hybrid_value = GeneratePHybridValue(row);
}
return p_hybrid_value;
}
I read few articles and they proposed to increase my stack size like that:
editbin /stack:4000000 NameOfTheExe.exe
I tried but it didn't help mi at all. Any suggestions. Please have in mind that the datatable I work with has 3257 rows and having the recursion for each row of that table! Thank you in advance!