Endless recursion

The BEAM uses Tail Call Optimization (TCO) to avoid blowing the stack.

As an example:

def fac(1), do: 1
def fac(n), do: n * fac(n -1)

is not TCO because the recursive can only be done when it is the last operation of the function. In the fac function above it needs to keep the frame to do the multiplication.

This can be re-written in a TCO fashion by using an accumulator to hold the result.

def fac(n), do: fac(n, 1)

def fac(1, result), do: result
def fac(n, result), do: fac(n - 1, n * result)

In your case the blink_forever(pid) call is the last in the function and hence will use TCO.