I have encountered a memory issue while using the Janus library to call Prolog from Python.
We use Janus to consult a 62mb Prolog file. At this point the memory usage of our program is low. We then perform many query_once calls. At this point, the memory usage of our program quickly grows (>10gb).
We are not adding anything to the Prolog database, so I am unsure what is wrong.
From a memory profile, the issue is our query_once
calls. We are making many queries, such as:
Thanks!
findall(_ID, (pos_index(_ID, stop(_V0)),( collidingclose(_V2,_V0),leftof(_V1,_V2),not_higherpri(_V2,_V1)-> true)), S)
Is there a reason why the Janus interface might inexorably use memory? If so, is there a way to prevent this memory explosion?
Might it be related to this feature (section('packages/janus.html')):
Note that the input argument may also be passed literally. Below we give two examples. We strongly advise against using string interpolation for three reasons. Firstly, the query strings are compiled and cached on the Prolog sided and (thus) we assume a finite number of distinct query strings.
Thanks,
Andrew