-
Hi there! I've heard Scryer has issues with garbage collection, but I can't prove it! I'd like to see what the practical implications are so I can experiment with some mitigation and best practices until GC is solid. Unfortunately I can't find the leaks! def memgrowth():
source = """
:- use_module(library(lists)).
:- use_module(library(dcgs)).
string --> [].
string --> [S], string, { member(S, "abcdefghijklmnopqrstuvwxyz01234567890") }.
"""
with ScryerMachine(source) as wam:
with wam.lazy_eval_context("phrase(string, Ls).") as query:
for _ in query:
pass
if __name__ == '__main__':
memtest()
I have been running this for an hour, and so far I have not detected any memory growth whatsoever. Does anyone have any experiments that could demonstrate the memory leaks? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
From @bakaq: ?- phrase(string, S), partial_string(S, _, _), false. This is showing the memory growth. |
Beta Was this translation helpful? Give feedback.
-
What you tested there is the fact that partial strings are currently allocated on the atom table, and the atom table isn't garbage collected. For heap garbage collection, which is usually more important, see also Precise Garbage Collection in Prolog. All the examples there leak currently in Scryer Prolog. |
Beta Was this translation helpful? Give feedback.
What you tested there is the fact that partial strings are currently allocated on the atom table, and the atom table isn't garbage collected.
For heap garbage collection, which is usually more important, see also Precise Garbage Collection in Prolog. All the examples there leak currently in Scryer Prolog.