summaryrefslogtreecommitdiff
path: root/repl.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-08 17:07:15 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-08 17:07:15 +0000
commit28e7dd47d568908702264977d70860c25467fb6e (patch)
tree61ec96a7ffc789fa518313ab5c78ead65d0db8a8 /repl.c
parent96639193bad1db5ff22f17bacbcd4eeecd024ba9 (diff)
Add a mark-sweep garbage collector
Diffstat (limited to 'repl.c')
-rw-r--r--repl.c6
1 files changed, 5 insertions, 1 deletions
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);
}
}