From 28e7dd47d568908702264977d70860c25467fb6e Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Thu, 8 Jul 2021 17:07:15 +0000 Subject: Add a mark-sweep garbage collector --- repl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'repl.c') diff --git a/repl.c b/repl.c index d179429..14e833c 100644 --- a/repl.c +++ b/repl.c @@ -16,7 +16,7 @@ repl(void) Term *query = parse(fd, nil, 1); Binding *bindings = nil; choicestack = nil; - goalstack = nil; /* should free old choicestack and goalstack */ + goalstack = nil; int success; int firsttime = 1; FindMore: @@ -50,6 +50,10 @@ FindMore: print(".\n"); } } + + vlong amount = collectgarbage(); + if(amount != 0) + print("Collected %lld bytes of garbage\n", amount); } } -- cgit v1.2.3