Eli5-What does a “stack overflow” mean?

1.23K views

Eli5-What does a “stack overflow” mean?

In: 847

41 Answers

Anonymous 0 Comments

First, what is stack and why do you need it? It’s not just any random data structure, on most architectures you have push pop instructions and stack pointer register. What push does is increment sp and write operand to address sp points to, pop reads from address sp points to and decrements sp. Super useful for handling function parameters and return values. But what happens when someone writes an infinite recursive loop? Then stack grows without bound until it runs out of allocated memory, that is stack overflow exception.

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