Fix some memory leaks

This commit is contained in:
2026-01-28 14:54:15 -08:00
parent de43dfcda2
commit 76b28c1dc0
8 changed files with 51 additions and 2 deletions
+23
View File
@@ -307,3 +307,26 @@ void lisp_gc_now(struct timespec *restrict time_took) {
++total_gc_count;
lisp_doing_gc = false;
}
void lisp_gc_teardown(void) {
assert(the_stack.depth == 0);
while (white_objects) {
free_object(white_objects->obj);
}
while (grey_objects) {
free_object(grey_objects->obj);
}
while (black_objects) {
free_object(black_objects->obj);
}
while (static_objects) {
struct GCObjectList *next = static_objects->next;
free(static_objects);
static_objects = next;
}
while (free_objects_list) {
struct GCObjectList *next = free_objects_list->next;
free(free_objects_list);
free_objects_list = next;
}
}