Freeing vector-space objects, apparently good.

Not freeing enough cons-space objects, though!
This commit is contained in:
Simon Brooke 2018-12-29 08:23:26 +00:00
parent 40e1f3ca64
commit ad806de656
3 changed files with 17 additions and 3 deletions

View file

@ -20,6 +20,8 @@
#include "conspage.h"
#include "debug.h"
#include "dump.h"
#include "stack.h"
#include "vectorspace.h"
/**
* Flag indicating whether conspage initialisation has been done.
@ -169,7 +171,18 @@ void free_cell( struct cons_pointer pointer ) {
debug_printf( DEBUG_ALLOC,
L"About to free vector-space object at %ld\n",
cell->payload.vectorp.address );
//free( ( void * ) cell->payload.vectorp.address );
struct vector_space_object *vso = cell->payload.vectorp.address;
switch ( vso->header.tag.value ) {
case STACKFRAMETV:
free_stack_frame(get_stack_frame(pointer));
break;
}
free( ( void * ) cell->payload.vectorp.address );
debug_printf( DEBUG_ALLOC,
L"Freed vector-space object at %ld\n",
cell->payload.vectorp.address );
break;
}

View file

@ -222,14 +222,14 @@ void free_stack_frame( struct stack_frame *frame ) {
/*
* TODO: later, push it back on the stack-frame freelist
*/
debug_print(L"Entering free_stack_frame\n", DEBUG_ALLOC);
for ( int i = 0; i < args_in_frame; i++ ) {
dec_ref( frame->arg[i] );
}
if ( !nilp( frame->more ) ) {
dec_ref( frame->more );
}
free( frame );
debug_print(L"Leaving free_stack_frame\n", DEBUG_ALLOC);
}

View file

@ -67,6 +67,7 @@ struct cons_pointer make_vso( char *tag, uint64_t payload_size ) {
struct vector_space_object *vso = malloc( padded );
if ( vso != NULL ) {
memset(vso, 0, padded);
debug_printf( DEBUG_ALLOC,
L"make_vso: about to write tag '%s' into vso at %p\n",
tag, vso );