Subject: Strange behaviour with large lists

From: Luis Iraola <[email-masked]>
Date: Mon, 16 Oct 2000 16:12:14 +0100 (BST)

Hello _,

Version 3.4.0 on Windows NT and 98 behaves funny when managing large lists
(10^5 elements) and the same goal is repeated several times.

The first time the goal is asked the systems answers quickly:

Welcome to SWI-Prolog (Version 3.4.0)
Copyright (c) 1990-2000 University of Amsterdam. 
Copy policy: GPL-2 (see www.gnu.org)

For help, use ?- help(Topic). or ?- apropos(Word).

?- findall(N,between(1,100000,N),L), findall(N,select(N,L,_),L).

N = _G5
L = [1, 2, 3, 4, 5, 6, 7, 8, 9|...] 

Yes

--------------- 0 -----------------
Second time, a couple of errors are raised immediately:

?- findall(N,between(1,100000,N),L), findall(N,select(N,L,_),L).
ERROR: Out of global stack
ERROR: Out of global stack
% Execution Aborted

--------------- 0 -----------------

Third time, a single error is raised after some time:

?- findall(N,between(1,100000,N),L), findall(N,select(N,L,_),L).
ERROR: Out of local stack
?- 

If the goal is asked a fourth or fifth time, the answer obtained is the
same as the third one.

The same behaviour is displayed if member/2 or append/3 is used instead of
select/3 in the second findall/3:

?- findall(N,between(1,100000,N),L), findall(N,member(N,L),L).
?- findall(N,between(1,100000,N),L), findall(N,append(_,[N|_],L),L).

With the first goal, the systems answers rightly, the second and third
times stack errors are reported.

On the contrary, if just the first findall/3 is queried, the system
behaves consistently all the times it is asked:

?- findall(N,between(1,100000,N),L).

Regards,

Luis.