stack guard size

stack guard size sets the size, in bytes, of the stack guard area, which is an overflow stack of configurable size at the end of each stack.

Summary Information

Default value


Range of values




Display level


Required role

System administrator

Configuration groups

Memory Use, User Environment

SAP ASE allocates one stack for each user connection and worker process when it starts. These stacks are located contiguously in the same area of memory, with a guard area at the end of each stack. At the end of each stack guard area is a guardword, which is a 4-byte structure with a known pattern. The figure below illustrates how a process can corrupt a stack guardword.

Note: (On UNIX platforms only) SAP recommends that you include an additional 4096 bytes when you configure stack guard size to a nondefault value to increase the usable portion of the stack guard area.
Process about to corrupt stack guardword
Graphic of a bar graph showing how a process over flows a stack area. The process proceeds until it hits the stack guard word, at which point it aborts the transaction.
SAP ASE periodically checks to see whether the stack pointer for a user connection has entered the stack guard area associated with that user connection’s stack. If it has, SAP ASE aborts the transaction, returns control to the application that generated the transaction, and generates error 3626:
The transaction was aborted because it used too much
stack space. Either use sp_configure to increase the 
stack size, or break the query into smaller pieces. 
spid: %d, suid: %d, hostname: %.*s, application name: 
SAP ASE also periodically checks the guardword pattern to see if it has changed, thus indicating that a process has overflowed the stack boundary. When this occurs, SAP ASE prints these messages to the error log and shuts down:
kernel: *** Stack overflow detected: limit: 0x%lx sp: 0x%lx
kernel: *** Stack Guardword corrupted
kernel: *** Stack corrupted, server aborting

In the first message, “limit” is the address of the end of the stack guard area, and “sp” is the current value of the stack pointer.

In addition, SAP ASE periodically checks the stack pointer to see whether it is completely outside both the stack and the stack guard area for the pointer’s process. If it is, SAP ASE shuts down, even if the guardword is not corrupted. When this happens, SAP ASE prints the following messages to the error log:
kernel: *** Stack overflow detected: limit: 0x%lx sp: 0x%lx
kernel: *** Stack corrupted, server aborting

The default value for stack guard size is appropriate for most applications. However, if you experience server shutdown from either stack guardword corruption or stack overflow, increase stack guard size by a 2K increment. Each configured user connection and worker process has a stack guard area; thus, when you increase stack guard size, you use up that amount of memory, multiplied by the number of user connections and worker processes you have configured.

Rather than increasing stack guard size to avoid stack overflow problems, consider increasing stack size . The stack guard area is intended as an overflow area, not as an extension to the regular stack.

SAP ASE allocates stack space for each task by adding the values of the stack size and stack guard size parameters. stack guard size must be configured in multiples of 2K. If the value you specify is not a multiple of 2K, sp_configure verification routines round the value up to the next highest multiple.