Skip to main content

Problem:

An stack overflow error or a  stackOverflowException can be easily corrected by increasing the size of the stack.

Knowledge base article 19007 - "STACK OVERFLOW, EXCEPTION_STACK_OVERFLOW <- increase stack's size of the process" describes how can you set up an environment variable to define a specific stack size when the executable is being created when linking.

This article describes how you can increase the size of an executable once it has already being created.

This affects to any kind of executable, even a .NET executable.

Resolution:

There is an SDK utility called editbin that allows you to change the stack size for an executable (amongst other things). Open a command prompt and cd to the directory where your application executable is, and then run:

   editbin /stack:nnn application.exe

where application.exe is the name of the executable of your application and nnn is the number of bytes in size than you want your stack to be.

For example:

   editbin /stack:20000000 myap.exe

Old KB# 6994