[erlang-questions] System getting hang after running normal recursion program

Ameretat Reith ameretat.reith@REDACTED
Sat Oct 7 13:34:50 CEST 2017


In C your infinite recursion will cause infinite increase in stack
size (infinite number of return addresses and local variables that
should be remembered). There are some languages coming with
optimizations making you able to call functions infinitely as long as
the last line of code is same function call [1] or another function
call [2]. Erlang is of latter type so if last code of your recursion
function is another function call, there is no reason to terminate it.
Stack won't grow infinitely and Is perfectly fine to keep running.

1: https://en.wikipedia.org/wiki/Tail_call
2: http://erlang.org/pipermail/erlang-questions/2016-October/090663.html



More information about the erlang-questions mailing list