Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use to-be-closed Lua values in machine Lua tests #42

Closed
edubart opened this issue May 24, 2023 · 0 comments · Fixed by #77
Closed

Use to-be-closed Lua values in machine Lua tests #42

edubart opened this issue May 24, 2023 · 0 comments · Fixed by #77
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@edubart
Copy link
Collaborator

edubart commented May 24, 2023

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 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.

@edubart edubart added the enhancement New feature or request label May 24, 2023
@edubart edubart added this to the v0.15.0 milestone May 24, 2023
@edubart edubart self-assigned this May 24, 2023
@edubart edubart moved this to In Progress in Machine Emulator SDK May 30, 2023
@edubart edubart removed this from the v0.15.0 milestone May 30, 2023
@edubart edubart moved this from In Progress to Todo in Machine Emulator SDK May 31, 2023
@edubart edubart moved this from Todo to In Progress in Machine Emulator SDK Jun 1, 2023
@edubart edubart linked a pull request Jun 6, 2023 that will close this issue
@edubart edubart added this to the v0.15.0 milestone Jun 6, 2023
@edubart edubart moved this from In Progress to Waiting Review in Machine Emulator SDK Jun 6, 2023
@edubart edubart moved this from Waiting Review to Waiting Merge in Machine Emulator SDK Jul 4, 2023
@github-project-automation github-project-automation bot moved this from Waiting Merge to Done in Machine Emulator SDK Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant