You can set the stack size in one of two ways:
Specify
the STACKSIZE statement in a module definition (.DEF) file for
the first thread of an application; use the _beginthread function
call for threads created later. By default, the linker reserves
32K of stack space for the first thread.
By
default, the linker reserves 1 MB of stack space and commits
(physically allocates) 1 page.
Setting the stack size using one of the options listed above overrides the default value. For example, specifying the linker option
/STACK:65536
sets the stack size to be 64K. Because the 16-bit stack is allocated from the 32-bit stack, you must ensure that the 32-bit stack is large enough for both your 32-bit and 16-bit code.
![]()
Stack Allocation
Stack Probes
Module Definition Files