- Feb 1, 2021
- 38
- 11
- 8
- Customer Identifier
- E074775
The default setting for the linker's stack option is one Megabyte. This means that the main thread and all other threads created by an Xbase++ application each get reserved one Megabyte of stack space. The stack space cannot be accessed directly by the application. Instead, this reserved area is used by the Xbase++ runtime for storing things like local variables, function return addresses and temporary buffers required for operation. Having enough stack available therefore is crucial for the stability of the application.
However, stack memory also is a precious resource. This memory must be contiguous and is allocated from a memory pool also being accessed by the operating system and also by the add-on tools used by the application. Therefore, in applications using many threads, increasing the stack size can lead to situations where no new threads can be created or other resource allocations fail due to memory shortage or fragmentation.
For these reasons, using /STACK for increasing the stack size is recommended only in special cases. Possible examples for this are:
However, stack memory also is a precious resource. This memory must be contiguous and is allocated from a memory pool also being accessed by the operating system and also by the add-on tools used by the application. Therefore, in applications using many threads, increasing the stack size can lead to situations where no new threads can be created or other resource allocations fail due to memory shortage or fragmentation.
For these reasons, using /STACK for increasing the stack size is recommended only in special cases. Possible examples for this are:
- code using a high recursion depth
- code using a very large number of LOCAL variables, possibly in combination with 1.
- usage of unusually complex UI controls
Last edited: