INFORMIX
DataBlade API Programmer's Manual
Chapter 11: Developing Server Functions
Home Contents Index Master Index New Book

Stack Space Allocation

Stacks are allocated from a common region in shared memory. Like all memory that user-defined routines use, stack segments can be overrun. The database server can only check for stack violations when the user-defined routine yields. Therefore, you must ensure that you:

    A user-defined routine needs to have enough stack space for all its local variables. By default, the database server allocates the stack with the size that the STACKSIZE configuration parameter specifies (32 kilobytes, if STACKSIZE is not set). To change this stack size for a user-defined routine, use the STACK routine modifier of the CREATE FUNCTION or CREATE PROCEDURE statement when you register your user-defined routine.

    The DataBlade API provides the mi_call() function to manage stack space. This function checks the amount of unused stack space and allocates additional stack segments if necessary.

The mi_call() function is not available for client applications.

The following example illustrates stack space allocation with mi_call():




DataBlade API Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.