Eli5-What does a “stack overflow” mean?

1.22K views

Eli5-What does a “stack overflow” mean?

In: 847

41 Answers

Anonymous 0 Comments

Computer programs are composed of groups of instructions known as subroutines. Subroutines are able to call other subroutines, so you can have subroutine A do some stuff, call subroutine B, and then do some more stuff once subroutine B has finished running.

In order to remember that it needs to finish running the rest of subroutine A after subroutine B is done, computers track subroutine calls in what’s known as the call stack. When subroutine A calls subroutine B, the computer will put some info about how far it had gotten through subroutine A on top of the call stack, and it’ll remove that info when subroutine B finishes running and we go back to subroutine A.

A stack overflow happens when there are too many subroutine calls for the call stack (which has a limited amount of memory) to hold. This usually happens when there’s a bug in the program that allows one or more subroutines to be called infinitely.

You are viewing 1 out of 41 answers, click here to view all answers.