Garbage collection now much better, not good

There's clearly still a lot of things getting incremented but not decremented.
This commit is contained in:
Simon Brooke 2018-12-29 09:35:29 +00:00
parent ad806de656
commit 7b126ea979
7 changed files with 39 additions and 6 deletions

View file

@ -128,8 +128,11 @@ bind( struct cons_pointer key, struct cons_pointer value,
struct cons_pointer
deep_bind( struct cons_pointer key, struct cons_pointer value ) {
debug_print( L"Entering deep_bind\n", DEBUG_BIND );
struct cons_pointer old = oblist;
oblist = bind( key, value, oblist );
inc_ref(oblist);
dec_ref(old);
debug_print( L"Leaving deep_bind\n", DEBUG_BIND );

View file

@ -194,9 +194,11 @@ struct cons_pointer
eval_lambda( struct cons_space_object cell, struct stack_frame *frame,
struct cons_pointer frame_pointer, struct cons_pointer env ) {
struct cons_pointer result = NIL;
debug_print( L"eval_lambda called\n", DEBUG_EVAL );
debug_print( L"eval_lambda called\n", DEBUG_LAMBDA );
debug_println(DEBUG_LAMBDA);
struct cons_pointer new_env = env;
inc_ref(new_env);
struct cons_pointer names = cell.payload.lambda.args;
struct cons_pointer body = cell.payload.lambda.body;
@ -236,11 +238,19 @@ eval_lambda( struct cons_space_object cell, struct stack_frame *frame,
struct cons_pointer sexpr = c_car( body );
body = c_cdr( body );
debug_print( L"In lambda: ", DEBUG_LAMBDA );
debug_print( L"In lambda: evaluating ", DEBUG_LAMBDA );
debug_print_object(sexpr, DEBUG_LAMBDA);
debug_println( DEBUG_LAMBDA);
result = eval_form( frame, frame_pointer, sexpr, new_env );
}
dec_ref(new_env);
debug_print( L"eval_lambda returning: \n", DEBUG_LAMBDA );
debug_print_object( result, DEBUG_LAMBDA);
debug_println(DEBUG_LAMBDA);
return result;
}