It seems that the reason behind this is the stack overflow. The issue can be resolved by increasing the stack size.
In visual studio you can do this by using /STACK:reserve[,commit]
. Read the MSDN article.
For more detailed explanation:
Under Windows platforms, the stack size information is contained in the executable files. It can be set during compilation in Visual studio C++.
Alternatively, Microsoft provides a program editbin.exe
which can change the
executable files directly. Here are more details:
Windows (during compilation):
- Select
Project->Setting
. - Select
Link
page. - Select
Category to Output
. - Type your preferred stack size in
Reserve:
field underStack
. eg,
allocations32768
in decimal or0x20000
in hexadecimal.
Windows (to modify the executable file):
There are two programs included in Microsoft Visual Studio, dumpbin.exe
and editbin.exe
. Run dumpbin /headers executable_file
, and you can see the size of stack reserve
information in optional header values
. Run editbin /STACK:size
to change the default stack size.