Entry
TSE: Error: Compile: 'Stack overflow in macro interpreter', when compiling a TSE macro
Oct 11th, 2003 10:53
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden - 14 November 2001 - 11:11 pm ---------------------
TSE: Error: Compile: 'Stack overflow in macro interpreter', when
compiling a TSE macro
---
Check if you do not have an infinite recursive loop (that is a
procedure
that calls itself, that is inside you see the same procedure name as
the procedure itself) somewhere in your program:
---
e.g.
PROC PROCa()
PROCa()
END
---
---
Reduce the macro variable store size in memory:
---
reduce the size of strings (e.g. via a global search/replace)
e.g.
instead of
STRING s[255]
use something like
STRING s[100]
---
ad 1. recursive loop
---
1. the best method is to run the TSE debugger (via menu 'Macro'-
>'Debug',
or similar <ESCAPE><M><D>).
Then check if the program runs in a loop, e.g. because a function
keeps calling itself.
You will very quickly find the offending code in that case.
2. put breakpoints in the program until you find the position(s)
where the error 'stack overflow' occurs.
3. use the function MacroStackAvail() to print out the stack size
at a given point in the program
e.g. insert the text:
Warn( "stack available here at PROC Main() - linenr=", CurrLine
(), " = ", MacroStackAvail() )
...
...
Warn( "stack available here at PROC MyProc() 1. - linenr=",
CurrLine(), " = ", MacroStackAvail() )
...
Warn( "stack available here at PROC MyProc() 2. - linenr=",
CurrLine(), " = ", MacroStackAvail() )
...
Warn( "stack available here at PROC MyProc() 3. - linenr=",
CurrLine(), " = ", MacroStackAvail() )
...
etc...
at the suspected positions in the program, and recompile
---
ad 2. size of macro variables
---
This are e.g. globals strings, global integers, ... .
so reduce the macro variable store size in memory:
-reduce the size of strings (e.g. via a global search/replace)
e.g.
instead of
STRING s[255]
use something like
STRING s[100]
-split the declaration of the variables in different files
-remove one or more variables, recompile, and check with
MacroStackAvail()
if the stack size decreases, and if the error does or does not
occur anymore.
----------------------------------------------------------------------