You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After we update to Lua 5.4, we should refactor code to use to-be-closed values to destroy machine in Lua tests, instead of relying on __gc and collectgarbage(). The problem with relying on __gc is that its call is non deterministic, and we can end up with many dead machine objects in Lua tests consuming huge amounts of memory in the host until a full GC cycle is run. Currently we workaround this by explicitly calling collectgarbage(), or worse, by doing nothing and letting the GC run automatically at unpredictable times at the risk of letting the host run out of memory.
Possible solutions
The machine Lua object should have a __close metamethod implemented, destroying the machine state. Then Lua code in tests relying on __gc should be reworked to use <close> variable annotation.
The text was updated successfully, but these errors were encountered:
Context
After we update to Lua 5.4, we should refactor code to use to-be-closed values to destroy machine in Lua tests, instead of relying on
__gc
andcollectgarbage()
. The problem with relying on__gc
is that its call is non deterministic, and we can end up with many dead machine objects in Lua tests consuming huge amounts of memory in the host until a full GC cycle is run. Currently we workaround this by explicitly callingcollectgarbage()
, or worse, by doing nothing and letting the GC run automatically at unpredictable times at the risk of letting the host run out of memory.Possible solutions
The machine Lua object should have a
__close
metamethod implemented, destroying the machine state. Then Lua code in tests relying on__gc
should be reworked to use<close>
variable annotation.The text was updated successfully, but these errors were encountered: