STACKSIZE Module Definition Statement

Syntax: Parameters:
STACKSIZE reserve[,commit]
  • Virtual stack size
  • Initial physical memory
STACKSIZE size Stack size in bytes

Use STACKSIZE to set the stack size (in bytes) of your program. The size must be an even number, from 0 to 0xFfffFffe. If you specify an odd number, it is rounded up to the next even number.

reserve indicates the total virtual address space reserved. commit sets the amount of physical memory to allocate initially. When commit is less than reserve, memory demands are reduced, although execution time may be slower.

Values specified by the /STACK linker option take precedence over the STACKSIZE statement.

The STACKSIZE statement is equivalent to the /STACK linker option.
If you specify both the statement and the option , the statement value
overrides the option value.

If your program generates a stack-overflow message, use the STACKSIZE statement to increase the size of the stack.

If your program uses the stack very little, you can save some space by decreasing the stack size.

The STACKSIZE statement is equivalent to the /STACK linker option. If you specify both the statement and the option, the statement value overrides the option value.

The following example allocates 4K of local-stack space:

STACKSIZE 4096

Note: You cannot specify a stack size in which the second most significant byte is either 02 or 04 ( in hex), because of a restriction in OS/2 2.0. The linker issues a warning, and adds 64k to the stack size to avoid the
restriction For example, if you specify STACKSIZE 0x00020000 the linker adds 64k , which results in STACKSIZE 0x00030000.

Similarly, if you specify STACKSIZE 0x11041111 the linker adds 64k,
which results in STACKSIZE 0x11051111



Summary of Module Definition Statements