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 --- misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 08aa339..fd74a82 100644 --- a/misc.c +++ b/misc.c @@ -8,7 +8,7 @@ Term * copyterm(Term *orig, uvlong *clausenr) { - Term *new = malloc(sizeof(Term)); + Term *new = gmalloc(sizeof(Term)); memcpy(new, orig, sizeof(Term)); new->next = nil; new->children = nil; @@ -47,7 +47,7 @@ termslength(Term *list) Term * mkterm(int tag) { - Term *t = malloc(sizeof(Term)); + Term *t = gmalloc(sizeof(Term)); t->tag = tag; t->next = nil; t->children = nil; @@ -142,7 +142,7 @@ mklist(Term *elems) Clause * copyclause(Clause *orig, uvlong *clausenr) { - Clause *new = malloc(sizeof(Clause)); + Clause *new = gmalloc(sizeof(Clause)); new->head = copyterm(orig->head, clausenr); if(orig->body) new->body = copyterm(orig->body, clausenr); -- cgit v1.2.3