Skip to content

Commit 6305d48

Browse files
committed
gc_free: give a better error when freeing outside of VM
1 parent f4a5c17 commit 6305d48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

py/gc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ void gc_free(void *ptr) {
667667
if (ptr == NULL) {
668668
GC_EXIT();
669669
} else {
670+
if (MP_STATE_MEM(gc_pool_start) == 0) {
671+
reset_into_safe_mode(GC_ALLOC_OUTSIDE_VM);
672+
}
670673
// get the GC block number corresponding to this pointer
671674
assert(VERIFY_PTR(ptr));
672675
size_t block = BLOCK_FROM_PTR(ptr);

0 commit comments

Comments
 (0)