Clear the buffer byte between ATB and FTB
This ensures it has a known start state. An unknown state risks it looking like a tail block similar to the problem fixed by #5245. Fixes #5305
This commit is contained in:
parent
dfba2ee26e
commit
e544909b5b
6
py/gc.c
6
py/gc.c
|
@ -150,8 +150,10 @@ void gc_init(void *start, void *end) {
|
||||||
assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_byte_len);
|
assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_byte_len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clear ATBs
|
// Clear ATBs plus one more byte. The extra byte might be read when we read the final ATB and
|
||||||
memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len));
|
// then try to count its tail. Clearing the byte ensures it is 0 and ends the chain. Without an
|
||||||
|
// FTB, it'll just clear the pool byte early.
|
||||||
|
memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len) + 1);
|
||||||
|
|
||||||
#if MICROPY_ENABLE_FINALISER
|
#if MICROPY_ENABLE_FINALISER
|
||||||
// clear FTBs
|
// clear FTBs
|
||||||
|
|
Loading…
Reference in New Issue