Previous Up Next

C.2  Stack Overflows

When a stack overflows, the system performs a throw/1 with an appropriate exit tag, i.e.,

for overflows of the global/trail stack that holds all the program’s data structures.
for overflows of the local/control stack that holds information related to the control flow.

These exits can be caught by wrapping a goal that is likely to overflow the stacks into an appropriate catch/3, e.g.,

..., catch(big_goal(X), global_trail_overflow, react_to_overflow), ...

In the debugger, you can locate the overflow by jumping to a LEAVE port (z command). See chapter 19 for more details on memory usage.

Previous Up Next