summaryrefslogtreecommitdiffstatshomepage
path: root/py/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/gc.c')
-rw-r--r--py/gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/gc.c b/py/gc.c
index a40b9878f9..86ed0ce30e 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -434,12 +434,13 @@ found:
ATB_FREE_TO_TAIL(bl);
}
- GC_EXIT();
-
// get pointer to first block
+ // we must create this pointer before unlocking the GC so a collection can find it
void *ret_ptr = (void*)(MP_STATE_MEM(gc_pool_start) + start_block * BYTES_PER_BLOCK);
DEBUG_printf("gc_alloc(%p)\n", ret_ptr);
+ GC_EXIT();
+
// zero out the additional bytes of the newly allocated blocks
// This is needed because the blocks may have previously held pointers
// to the heap and will not be set to something else if the caller