Problem:
RTS 114 error with optimized (GNT) code whilst debugging in MFE 3.1
The problem does not occur when using non-optimized (INT) code.
Resolution:
This problem can occur if a program has a large item declared within Local-Storage.
MFEDEBUG.LOG is generated during the debugging process, and can be checked for exceptions.
Check mfdebug.log and look for exception type - EXCEPTION_STACK_OVERFLOW.
This indicates that the program has run out of stack space.
Local-storage is allocated on the stack which is limited by the system.
The standard stack allocation for a program on Windows is 1MB.
The best course of action is either
- to move the large item to WORKING-STORAGE where it will not need to be allocated from the stack, or
- if it genuinely needs to be allocated locally for recursive purposes, then use CBL_ALLOC_MEM to allocate it dynamically.
Why is there a difference?
Because an INT module is an abstract format run by our interpreter, the interpreter can allocate LOCAL-STORAGE dynamically as each program is loaded – as this comes from heap memory rather than the stack.
A GNT module actually runs machine code so LOCAL-STORAGE is allocated from the stack as the machine expects.
#MFDS
#MFE
#EnterpriseDeveloper