trealla-prolog / trealla

A compact, efficient Prolog interpreter written in plain-old C.
MIT License
265 stars 14 forks source link

Tail recursion and garbage collection #580

Open Jean-Luc-Picard-2021 opened 1 month ago

Jean-Luc-Picard-2021 commented 1 month ago

Strange it can allocate one run:

$ ulimit -m 2000000
$ ulimit -v 2000000
$ ./tpl -v
Trealla Prolog (c) Infradig 2020-2024, v2.55.18
$ ./tpl
?- ['bomb.p'].
true
?- garbage(12,_).
   true.

But not repeatedly:

?- foo.
   throw(error(resource_error(memory),app/3)).

SWI-Prolog has no problems with the test case, it somehow can reclaim the annonymous variable term.

Source code:

bomb.p.log

infradig commented 1 month ago

See also #305