Manage stack space

Session threads execute C UDRs and their thread-stack space is allocated from a common region in shared memory. The thread stack stores nonshared data for the UDRs and system routines that the thread executes. This stack contains everything that would normally be on the execution stack, including routine arguments (including the MI_FPARAM structure, local (stack) variables, and function return values.

Like all memory that UDRs use, stack segments can be overrun. The database server can only check for stack violations when the UDR yields. Therefore, you must ensure that you perform the following tasks within a UDR:
  • Efficiently manage stack space usage in your UDR

    Limit usage of stack space in your UDR and ensure sufficient stack-space allocation when you register the UDR.

  • Use the mi_call() function for UDRs that potentially use unlimited recursion.