]> git.lizzy.rs Git - nothing.git/blobdiff - src/script/gc.c
TODO(#394)
[nothing.git] / src / script / gc.c
index f447d366e8f6c29db1578c51b8d74aca1e92294d..0bff5c3d4e650263d7b2e266d00777573952bdbc 100644 (file)
@@ -84,6 +84,11 @@ Gc *create_gc(void)
 void destroy_gc(Gc *gc)
 {
     assert(gc);
+
+    for (size_t i = 0; i < gc->size; ++i) {
+        destroy_expr(gc->exprs[i]);
+    }
+
     RETURN_LT0(gc->lt);
 }
 
@@ -171,3 +176,15 @@ void gc_collect(Gc *gc, struct Expr root)
         }
     }
 }
+
+void gc_inspect(const Gc *gc)
+{
+    for (size_t i = 0; i < gc->size; ++i) {
+        if (gc->exprs[i].type == EXPR_VOID) {
+            printf(".");
+        } else {
+            printf("+");
+        }
+    }
+    printf("\n");
+}