When I run the function below, I get different results on different browsers:
function maxCallStackSize0() {
try {
return 1 + maxCallStackSize0();
} catch (e) {
return 1;
}
}
maxCallStackSize0(); // Opera: 32354, Chrome: 12795
But that's not all. The result also changes if I run it manually multiple times:
maxCallStackSize0(); // Opera: 34724
maxCallStackSize0(); // Opera: 33776
maxCallStackSize0(); // Opera: 34030
Is that because of other functions being called in the background taking up some of the stack?
I have also seen that the more arguments I pass, the smaller the call stack:
function maxCallStackSize3(s1, s2, s3, s4) {
try {
return 1 + maxCallStackSize3(s1, s2, s3, s4);
} catch (e) {
return 1;
}
}
maxCallStackSize3("hello", "how", "are", "you"); // Opera: 13979, Chrome: 6971
Is that because the parameters are part of the call stack, and the more/the bigger size parameters I pass, the shorter the call stack can be before it overflows?
Is it possible to know the maximum size of the call stack in bytes?
Thanks