Skip to content

Commit

Permalink
Address #1263
Browse files Browse the repository at this point in the history
Fix reference counting when cleaning up unused abstract types
per-thread.
  • Loading branch information
bakpakin committed Aug 20, 2023
1 parent ca4c1e4 commit b7f8224
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,15 @@ void janet_sweep() {
if (head->type->gc) {
janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
}
/* Mark as tombstone in place */
items[i].key = janet_wrap_nil();
items[i].value = janet_wrap_false();
janet_vm.threaded_abstracts.deleted++;
janet_vm.threaded_abstracts.count--;
/* Free memory */
janet_free(janet_abstract_head(abst));
}

/* Mark as tombstone in place */
items[i].key = janet_wrap_nil();
items[i].value = janet_wrap_false();
janet_vm.threaded_abstracts.deleted++;
janet_vm.threaded_abstracts.count--;
}

/* Reset for next sweep */
Expand Down

0 comments on commit b7f8224

Please sign in to comment.