Default stack size

后端 未结 1 1789
轻奢々
轻奢々 2021-01-01 03:24

How can I increase the stack size in Code::Blocks?

I\'ve read this and it says default stack size in VS is 1MB. Now as far as I am concerned, it has nothing to do wi

相关标签:
1条回答
  • 2021-01-01 03:41

    The default size comes from the .exe, not the OS.

    From MSDN:

    The default size for the reserved and initially committed stack memory is specified in the executable file header.

    Specifically, the stack reserve and commit sizes are specified in the IMAGE_OPTIONAL_HEADER structure in a PE file. This can usually be set to a specific value with a linker parameter. With the MinGW toolchain you can try something like -Wl,--stack,52428800 as a gcc parameter. This option might exist in the IDE you are using, just look for build and/or linker settings.

    This applies to the first thread, other threads can override the default if you specify a non-zero value when you call CreateThread.

    0 讨论(0)
提交回复
热议问题