DELAPARRA
Index
Color
NL
Category: Error types

StackOverflowError

Explained by Updated

What is StackOverflowError?

StackOverflowError: The call stack ran out of space — usually caused by infinite recursion (a function that keeps calling itself forever). A StackOverflowError, or "Maximum call stack size exceeded" in JavaScript, means the call stack ran out of space. Each function call adds a frame to the stack, and something kept adding frames without ever returning.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about StackOverflowError

How is StackOverflowError used in practice?

The usual cause is recursion without a working stop condition: a function that calls itself forever. Indirect loops cause it too, such as two functions calling each other, or two objects whose methods reference each other while converting to JSON.

What should you keep in mind with StackOverflowError?

The stack trace typically shows the same few function names repeating, which points straight at the loop. Check the base case of recursive functions, and watch for relationships that refer back to each other. For processing deep structures like large trees, an iterative approach with your own list of items to visit avoids the limit entirely.

At a glance

CategoryError types
Explained by
Updated

More Error types terms

All terms starting with S

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.