1
0
forked from Mirror/wren

Merge pull request #1195 from rune-scape/gray-fn-module

Mark a functions module as reachable for the GC
This commit is contained in:
.ruby
2025-03-10 17:46:00 -07:00
committed by GitHub

View File

@ -1089,6 +1089,9 @@ static void blackenFn(WrenVM* vm, ObjFn* fn)
// Mark the constants.
wrenGrayBuffer(vm, &fn->constants);
// Mark the module it belongs to, in case it's been unloaded.
wrenGrayObj(vm, fn->module);
// Keep track of how much memory is still in use.
vm->bytesAllocated += sizeof(ObjFn);
vm->bytesAllocated += sizeof(uint8_t) * fn->code.capacity;