This question is a followup from this question.
I'm running a large number of tests in Sicstus prolog:
runtest:-
t1,
t2,
t3,
.
.
t100.
Each test is standalone and will print its result to the screen. There is no releation between the tests, so no data need to be stored/saved between each test.
My problem is that Sicstus accumulates memory and finally hits an exception: 'Resource error: insufficient memory'
I have tried to organize my test like this:
runtest:-
once( t1 ),
once( t2 ),
.
.
once( t100 ).
But I still get into the problem.
Is there any other way to tell Prolog to free all allocated memory between each call to a test?
No, there is no way to tell Prolog to free all allocated memory.
If the test predicates takes no arguments, and wrapping them in once/1 does not help, then a failure driven loop also should not help.
One possibility is that your tests somehow add persistent data, e.g. asserts clauses.
Try adding
garbage_collect, statistics
between (some of) the test. This should give you an idea about which memory areas are growing.
From looking at your earlier question, it could be that one of your tests runs out of memory all by itself, i.e. that the problem is unrelated to running multiple tests.
Try using a (modern) failure driven loop: should reclaim memory on any Prolog
?- forall(member(T, [t1,t2,...,t100]), once(T)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With