mirror of
https://github.com/janet-lang/janet
synced 2025-11-06 18:43:04 +00:00
Address #1263
Fix reference counting when cleaning up unused abstract types per-thread.
This commit is contained in:
@@ -370,14 +370,15 @@ void janet_sweep() {
|
|||||||
if (head->type->gc) {
|
if (head->type->gc) {
|
||||||
janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
|
janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
|
||||||
}
|
}
|
||||||
|
/* Free memory */
|
||||||
|
janet_free(janet_abstract_head(abst));
|
||||||
|
}
|
||||||
|
|
||||||
/* Mark as tombstone in place */
|
/* Mark as tombstone in place */
|
||||||
items[i].key = janet_wrap_nil();
|
items[i].key = janet_wrap_nil();
|
||||||
items[i].value = janet_wrap_false();
|
items[i].value = janet_wrap_false();
|
||||||
janet_vm.threaded_abstracts.deleted++;
|
janet_vm.threaded_abstracts.deleted++;
|
||||||
janet_vm.threaded_abstracts.count--;
|
janet_vm.threaded_abstracts.count--;
|
||||||
/* Free memory */
|
|
||||||
janet_free(janet_abstract_head(abst));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset for next sweep */
|
/* Reset for next sweep */
|
||||||
|
|||||||
Reference in New Issue
Block a user