triska / clpz

Constraint Logic Programming over Integers
https://www.metalevel.at/prolog/clpz
184 stars 15 forks source link

leaking constraints #20

Closed UWN closed 1 year ago

UWN commented 1 year ago

In SICStus:

| ?- call_residue_vars(X in 1..2,Vs).
Vs = [X,_A,_B,_C,_D,_E,_F],
clpz:(X in 1..2) ? ;
no
| ?- [user].
% compiling user...
| l :- X in 1..2, X = 1, l.
| 
% compiled user in module user, 4 msec 2752 bytes
yes
| ?- catch(l,error(E,_),true).
   E = resource_error(memory), unexpected.
$ ulimit -v
500000
triska commented 1 year ago

I have installed a change to address this, could you please try it and post the results? Thank you a lot!

UWN commented 1 year ago

Perfect! SICStus now loops happily for l/0!

triska commented 1 year ago

I think the original case shows a GC issue in SICStus Prolog: After X = 1, the attributes on X are no longer reachable, and so should be GCed.

UWN commented 1 year ago

What means reachable to you? If it is reachable via call_residue_vars/2, then it is reachable.