Fix some memory leaks
This commit is contained in:
+16
@@ -26,6 +26,21 @@ void lisp_init_stack(void) {
|
||||
the_stack.nogc_retval = Qnil;
|
||||
}
|
||||
|
||||
static void teardown_stack_frame(struct StackFrame *restrict frame) {
|
||||
for (size_t i = 0; i < frame->local_refs.num_blocks; ++i) {
|
||||
lisp_free(frame->local_refs.blocks[i]);
|
||||
}
|
||||
lisp_free(frame->local_refs.blocks);
|
||||
}
|
||||
|
||||
void lisp_teardown_stack(void) {
|
||||
assert(the_stack.depth == 0);
|
||||
for (size_t i = 0; i < the_stack.max_depth; ++i) {
|
||||
teardown_stack_frame(&the_stack.frames[i]);
|
||||
}
|
||||
lisp_free(the_stack.frames);
|
||||
}
|
||||
|
||||
void push_stack_frame(LispVal *name, LispVal *fobj, LispVal *args) {
|
||||
assert(the_stack.depth < the_stack.max_depth);
|
||||
struct StackFrame *frame = &the_stack.frames[the_stack.depth++];
|
||||
@@ -164,6 +179,7 @@ void add_local_reference(LispVal *obj) {
|
||||
while ((cur = next_local_reference(&i))) {
|
||||
add_local_refs_for_object_sub_vals(seen_objs, cur);
|
||||
}
|
||||
release_hash_table_no_gc(seen_objs);
|
||||
}
|
||||
|
||||
void compact_stack_frame(struct StackFrame *restrict frame) {
|
||||
|
||||
Reference in New Issue
Block a user