The information in this article applies to:
SUMMARYBy default, space is reserved for applications in the following manner:
The default stack size is taken from the process default reserve stack
size.
The operating system will grow the stack as needed by committing 1 page blocks (4K on an x86 machine) out of the reserved stack memory. Once all of the reserved memory has been committed, Windows NT will attempt to continue to grow the stack into the memory adjacent to the memory reserved for the stack, as shown in the following example on an x86 machine:
However, once the stack grows to the point that the adjacent area is not
free (and this may happen as soon as the reserved 1 MB has been committed),
the stack cannot grow any farther. Therefore, it is very risky to rely on
this memory being free. Applications should take care to reserve all the
memory that will be needed by increasing the amount of memory reserved for
the stack.
In other cases, it may be desirable to reduce the amount of memory reserved for the stack. The /STACK option in the linker and the STACKSIZE statement in the DEF file can be used to change both the amount of reserved memory and the amount of committed memory. The syntax for each method is shown below:
MORE INFORMATION
Each new thread gets its own stack space of committed and reserved memory.
CreateThread() has a stacksize parameter, which is the commit size. If a
new size is not specified in the CreateThread() call, the new thread
takes on the same stack size as the thread that created it, whether that be
the default value, a value defined in the DEF file, or by the linker
switch. If the commit size specified is larger than the default process
stack size, the stack size is set to the commit size. When specifying a
stack size of 0, the commit size is taken from the process default commit.
Additional query words: 3.10 3.50
Keywords : kbAPI kbKernBase kbMemory kbNTOS310 kbNTOS350 kbNTOS351 kbNTOS400 kbWinOS2000 kbDSupport kbGrpKernBase |
Last Reviewed: January 11, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |