From 87b1a0d4a833dd0b2164481be45f7d1c59375040 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 15 Oct 2021 17:58:05 +0200 Subject: Add boilerplate for GC allocator --- src/bootstrap/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/bootstrap/main.c') diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c index 5191fd0..575a924 100755 --- a/src/bootstrap/main.c +++ b/src/bootstrap/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -12,6 +13,7 @@ #include "objects.c" #include "parser.c" #include "environment.c" +#include "gc.c" #include "primitives.c" // @@ -26,6 +28,9 @@ void init(void) { + // Initialize garbage collector. + init_gc(); + // Initialize singletons. obj_nil = alloc_object(OBJ_TYPE_NIL); obj_true = alloc_object(OBJ_TYPE_BOOL); @@ -99,7 +104,6 @@ process_source(const StringView *source) { while (has_next_token(&visitor) && peek_token(&visitor).type != TOKEN_EOF) { Object *root = parse_tree(&visitor); if (root == obj_err || errors_n != 0) { - free_objects(root); break; } @@ -109,7 +113,6 @@ process_source(const StringView *source) { display(result); printf("\n"); } - free_objects(root); } if (tokens.buf != NULL) { -- cgit v1.2.1