Skip to content

Commit

Permalink
Fix gc_alloc_possible()
Browse files Browse the repository at this point in the history
The BLE workflow was allocating to the VM heap when it wasn't
active and causing a port_malloc.
  • Loading branch information
tannewt committed Sep 12, 2024
1 parent 03b077d commit 30d57b1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions py/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,10 @@ void gc_info(gc_info_t *info) {
GC_EXIT();
}

// CIRCUITPY-CHANGE
// CIRCUITPY-CHANGE: C code may be used when the VM heap isn't active. This
// allows that code to test if it is. It can use the outer pool if needed.
bool gc_alloc_possible(void) {
#if MICROPY_GC_SPLIT_HEAP
return MP_STATE_MEM(gc_last_free_area) != 0;
#else
return MP_STATE_MEM(area).gc_pool_start != 0;
#endif
}

void *gc_alloc(size_t n_bytes, unsigned int alloc_flags) {
Expand Down

0 comments on commit 30d57b1

Please sign in to comment.