Skip to content

test: report which emulator instance and which root leak in the machine leak guard - #2489

Closed
maximilien-noal wants to merge 1 commit into
masterfrom
fix/leak
Closed

maximilien-noal wants to merge 1 commit into
masterfrom
fix/leak

Conversation

@maximilien-noal

Copy link
Copy Markdown
Member

Description of Changes

  • When the MachineLeakGuard suite-wide check detects a surviving emulator instance, the failure message now includes diagnostics: the creation stack of every surviving Machine, plus a scan of loaded assemblies for static fields that directly reference (or hold an object referencing) it.
  • The same diagnostics are written to tmp/machine-leak-diagnostic.txt when 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.
  • If the leak reproduces in CI, the failure message now contains the creation stack and static-field scan; those identify the test that created the leaked machine and its root.

Capture the creation stack and static fields referencing surviving emulator instances so a leaking machine can be identified from the failure output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant