trealla
trealla copied to clipboard
Tail recursion and garbage collection
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: