Skip to content

Commit

Permalink
Merge pull request #451 from s-hadinger/gc_shared_ktab
Browse files Browse the repository at this point in the history
Avoid gc of share ktab
  • Loading branch information
skiars authored Nov 15, 2024
2 parents 828cf43 + c9cfc26 commit 9a7c4b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/be_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ static void free_proto(bvm *vm, bgcobject *obj)
bproto *proto = cast_proto(obj);
gc_try (proto != NULL) {
be_free(vm, proto->upvals, proto->nupvals * sizeof(bupvaldesc));
be_free(vm, proto->ktab, proto->nconst * sizeof(bvalue));
if (!(proto->varg & BE_VA_SHARED_KTAB)) { /* do not free shared ktab */
/*caveat: the shared ktab is never GCed, in practice this is not a problem */
/* since shared ktab are primarily meant for solidification hence not gc-able */
be_free(vm, proto->ktab, proto->nconst * sizeof(bvalue));
}
be_free(vm, proto->ptab, proto->nproto * sizeof(bproto*));
be_free(vm, proto->code, proto->codesize * sizeof(binstruction));
#if BE_DEBUG_RUNTIME_INFO
Expand Down

0 comments on commit 9a7c4b5

Please sign in to comment.