A stack overflow occurs with the call stack exceeds the memory allocated for the function or subroutine. A classic example of stack overflow is infinite recursion methods without stops.

References

(2025). Stack overflow. [Online]. Available at: https://en.wikipedia.org/wiki/Stack_overflow [Accessed 6 August 2025].