@@ -378,6 +378,7 @@ static bool gc_try_add_heap(size_t failed_alloc) {
378378 total_blocks += area -> gc_alloc_table_byte_len * BLOCKS_PER_ATB ;
379379 }
380380
381+ // CIRCUITPY-CHANGE
381382 size_t total_heap = compute_heap_size (total_blocks );
382383
383384 DEBUG_printf ("total_heap " UINT_FMT " bytes\n" , total_heap );
@@ -500,6 +501,7 @@ static void MP_NO_INSTRUMENT PLACE_IN_ITCM(gc_mark_subtree)(size_t block)
500501 // check that the consecutive blocks didn't overflow past the end of the area
501502 assert (area -> gc_pool_start + (block + n_blocks ) * BYTES_PER_BLOCK <= area -> gc_pool_end );
502503
504+ // CIRCUITPY-CHANGE
503505 // check if this block should be collected
504506 #if MICROPY_ENABLE_SELECTIVE_COLLECT
505507 bool should_scan = CTB_GET (area , block );
@@ -1007,6 +1009,7 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags) {
10071009 (void )has_finaliser ;
10081010 #endif
10091011
1012+ // CIRCUITPY-CHANGE
10101013 #if MICROPY_ENABLE_SELECTIVE_COLLECT
10111014 bool do_not_collect = (alloc_flags & GC_ALLOC_FLAG_DO_NOT_COLLECT ) != 0 ;
10121015 GC_ENTER ();
@@ -1186,6 +1189,7 @@ void *gc_realloc(void *ptr, mp_uint_t n_bytes) {
11861189void * gc_realloc (void * ptr_in , size_t n_bytes , bool allow_move ) {
11871190 // check for pure allocation
11881191 if (ptr_in == NULL ) {
1192+ // CIRCUITPY-CHANGE
11891193 return gc_alloc (n_bytes , 0 );
11901194 }
11911195
@@ -1331,6 +1335,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
13311335 }
13321336 #endif
13331337
1338+ // CIRCUITPY-CHANGE
13341339 #if MICROPY_ENABLE_SELECTIVE_COLLECT
13351340 if (!CTB_GET (area , block )) {
13361341 alloc_flags |= GC_ALLOC_FLAG_DO_NOT_COLLECT ;
@@ -1345,6 +1350,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
13451350 }
13461351
13471352 // can't resize inplace; try to find a new contiguous chain
1353+ // CIRCUITPY-CHANGE
13481354 void * ptr_out = gc_alloc (n_bytes , alloc_flags );
13491355
13501356 // check that the alloc succeeded
0 commit comments