gc_free: give a better error when freeing outside of VM

This commit is contained in:
Jeff Epler 2019-12-10 17:05:47 -06:00
parent f4a5c17b5e
commit 6305d48947

View File

@ -667,6 +667,9 @@ void gc_free(void *ptr) {
if (ptr == NULL) {
GC_EXIT();
} else {
if (MP_STATE_MEM(gc_pool_start) == 0) {
reset_into_safe_mode(GC_ALLOC_OUTSIDE_VM);
}
// get the GC block number corresponding to this pointer
assert(VERIFY_PTR(ptr));
size_t block = BLOCK_FROM_PTR(ptr);