diff --git a/py/gc.c b/py/gc.c index b333c517d4..dcf07c6467 100644 --- a/py/gc.c +++ b/py/gc.c @@ -363,6 +363,7 @@ bool gc_is_locked(void) { return MP_STATE_THREAD(gc_lock_depth) != 0; } +// CIRCUITPY-CHANGE bool gc_ptr_on_heap(void *ptr) { for (mp_state_mem_area_t *area = &MP_STATE_MEM(area); area != NULL; area = NEXT_AREA(area)) { if (ptr >= (void *)area->gc_pool_start // must be above start of pool diff --git a/py/gc.h b/py/gc.h index 6a2a4856e3..22b958980f 100644 --- a/py/gc.h +++ b/py/gc.h @@ -85,6 +85,7 @@ void *gc_realloc(void *ptr, size_t n_bytes, bool allow_move); // very sparingly because it can leak memory. bool gc_never_free(void *ptr); +// CIRCUITPY-CHANGE // True if the pointer is on the MP heap. Doesn't require that it is the start // of a block. bool gc_ptr_on_heap(void *ptr);