Repository navigation
test: report which emulator instance and which root leak in the machine leak guard - #2489
Closed
maximilien-noal wants to merge 1 commit into
Closed
maximilien-noal wants to merge 1 commit into
maximilien-noal wants to merge 1 commit into
Conversation
Capture the creation stack and static fields referencing surviving emulator instances so a leaking machine can be identified from the failure output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
MachineLeakGuardsuite-wide check detects a surviving emulator instance, the failure message now includes diagnostics: the creation stack of every survivingMachine, plus a scan of loaded assemblies for static fields that directly reference (or hold an object referencing) it.tmp/machine-leak-diagnostic.txtwhen run locally.Rationale behind Changes
The CI run of 2026-11-08 failed with "1 of 3379 emulator instances created via Spice86Creator were still alive after disposal and garbage collection", but the message gave no way to identify the leaked machine or the root that keeps it alive. The guard now self-reports the creation point of the surviving instance and any static root, so the next CI failure is directly actionable.
This is a diagnostic step toward fixing the intermittent leak; the leak itself has not reproduced on 10 local full-suite runs (Debug and Release, Windows).
Suggested Testing Steps
dotnet test tests/Spice86.Tests— full suite; the guard passes and no diagnostics are produced.dotnet test tests/Spice86.Tests -- --filter-class '*BreakpointTests*'— quick sanity check, 18 tests pass.