Fix some memory leaks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user