| Previous | Next |
| STATUS_REDIRECTOR_STARTED | STATUS_NO_SUCH_PACKAGE |
STATUS_STACK_OVERFLOW
The stack could no longer grow safely
Windows grows a thread stack on demand by committing pages as execution reaches the guard page. This exception is raised when another guard page cannot be established, commonly because recursion is too deep, stack frames are unusually large, or repeated _alloca allocations consume the reserved range. Corruption of the stack pointer can produce the same symptom by jumping outside the valid stack.
The deepest visible function is not always the cause; the full repeating call pattern and frame sizes matter. Recovery is difficult because exception handling itself needs stack space. Native code that deliberately catches an overflow must unwind enough frames and restore the guard state with _resetstkoflw before performing substantial work. Most applications should capture a dump and terminate the failing operation instead of continuing in an uncertain state.
What to inspect
- Inspect the complete stack for recursion cycles and unusually large local objects.
- Compare the current stack pointer with the thread stack reserve and commit limits.
- Search for _alloca, large arrays, and callbacks that recursively re-enter the same path.
- Do not catch and continue unless the stack guard has been restored correctly.
References
- Microsoft Learn: Debugging a Stack Overflow
- Microsoft Learn: _resetstkoflw
- Microsoft Learn: Thread Stack Size
- Microsoft Learn: Creating Guard Pages
Looking for a different code? Search another status or error code.
