diff --git a/src/sandbox.lua b/src/sandbox.lua index 941d66d..c3e377a 100644 --- a/src/sandbox.lua +++ b/src/sandbox.lua @@ -449,11 +449,19 @@ coroutine.yield() -- startup delay local f = bootstrap() local co = coroutine.create(f) +local gcInterval = 0.25 +local lastGC = computer.uptime() + while true do timeout = nextDeadline() bubbleYield = false collectgarbage() + if computer.uptime() - lastGC >= gcInterval then + collectgarbage("collect") + lastGC = computer.uptime() + end + local ok, err = coroutine.resume(co) if not ok then