diff --git a/py/gc.c b/py/gc.c index 6d6aa717ba356..69ab969da71e7 100644 --- a/py/gc.c +++ b/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); #endif - // clear ATBs - memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len)); + // Clear ATBs plus one more byte. The extra byte might be read when we read the final ATB and + // 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 // clear FTBs
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: