Quantcast
Channel: Visual COBOL Knowledge Base
Viewing all articles
Browse latest Browse all 214

Stack Overflow Error in native Cobol

$
0
0
Current Revision posted to Visual COBOL Knowledge Base by Angela on 3/14/2013 9:58:38 AM

Problem:

During runtime you get Stack Overflow errors when Cobol DLLs are called. As the levels of inheritance grow up to a specific level everything runs fine, but when you move a step down in the inheritance level you get a stack overflow error.

Solution:

The usual cause of this kind of exception is that there is not enough stack space, and this is one of those cases. 

The default stack size for a Windows executable is only 1Mb. To increase the stack size there are a couple of options here ...

1) Build the top-level code to an exe, and include a larger stack size

e.g. set link=/stack:2000000
cbllink cobclient.cbl

2) Use editbin (in a VS command prompt) on the MF run trigger, to increase its stack size

e.g. editbin /stack:2000000 run.exe

The issue will not appear with INT code since in that case local storage is dynamically allocated from the Windows heap rather than from the system stack.

Tags: Stack Overflow

Viewing all articles
Browse latest Browse all 214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>