Commit 37ada236 authored by Damien George's avatar Damien George
Browse files

py: Take gc_pool_start out of bss section, to reclaim 1st block of heap.

parent 923a8a83
......@@ -58,7 +58,11 @@ STATIC mp_uint_t gc_alloc_table_byte_len;
STATIC byte *gc_finaliser_table_start;
STATIC mp_uint_t *gc_pool_start;
// We initialise gc_pool_start to a dummy value so it stays out of the bss
// section. This makes sure we don't trace this pointer in a collect cycle.
// If we did trace it, it would make the first block of the heap always
// reachable, and hence we can never free that block.
STATIC mp_uint_t *gc_pool_start = (void*)4;
STATIC mp_uint_t *gc_pool_end;
STATIC int gc_stack_overflow;
......@@ -153,13 +157,6 @@ void gc_init(void *start, void *end) {
memset(gc_finaliser_table_start, 0, gc_finaliser_table_byte_len);
// allocate first block because gc_pool_start points there and it will never
// be freed, so allocating 1 block with null pointers will minimise memory loss
for (int i = 0; i < WORDS_PER_BLOCK; i++) {
gc_pool_start[i] = 0;
// set last free ATB index to start of heap
gc_last_free_atb_index = 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment