[comp.lang.prolog] Global Stack Overflow

sundar@cwruecmp.UUCP (Sundar Iyengar) (06/27/87)

Recently someone asked how to circumvent the global stack
overflow problem.  A simple solution is to increase its size
using command line switches.  For example, the following command,
	cprolog -g 1000
allocates 1000K for the global stack.  However, this may cause
your program to run slower.  CProlog allocates all the space
it needs first before starting.  This means, you must have
sufficient disk space to swap in and swap out pages.  On Apollo
nodes on which I run C-Prolog, this causes great slow down in 
the program run time performance.

I have a related question to Prolog Experts.  According
to David Warren's thesis, global stack is an area reserved
for global variables.  The lifetime of these variables is
supposed end on backtracking past the procedure head in
which they appear.  Theoretically the space is supposed
to be recovered.  For some reason, this is not happening
in our C-Prolog.  I have experimented with using cuts to
remove all unnecessary choice points for almost all procedures
in the program, but still I can't seem to stop the global
stack from growing for ever (right now, I am getting by
with 4M sized global stack, which seems to be bit too much).
I am not sure if I am doing anything wrong.  Could some one
please help?  We are running C-Prolog 1.5 with mods from
Caltech.

Thanks.

Sundar R. Iyengar		

ARPA, CSNET: sundar@cwru.edu   <---------------------- Note new address
UUCP:        {decvax,cbatt,cbosgd,sun}!cwruecmp!sundar

USNAIL: 531, Crawford, Case Western Reserve University
        Cleveland, OH 44106