From c040a59b25d91e9166b1442b38fd3b4036cc7fcd Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Sat, 17 Oct 2026 06:35:17 +0000 Subject: [PATCH] Collect the documented examples' compilations as the test runs them Each example is compiled on its own, and the collector left the compilations standing: alone the test peaked at 2.4 GB, and in the full suite the test host reached 8 GB. Collected every fifth example it peaks at 570 MB, for 3 s more, and the suite at 2.4 GB. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --- .../UnitTests/Convenience/DocumentationExamplesRunTest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Tests/UnitTests/Convenience/DocumentationExamplesRunTest.cs b/Sources/Tests/UnitTests/Convenience/DocumentationExamplesRunTest.cs index bb5acb0a8..81587a9c5 100644 --- a/Sources/Tests/UnitTests/Convenience/DocumentationExamplesRunTest.cs +++ b/Sources/Tests/UnitTests/Convenience/DocumentationExamplesRunTest.cs @@ -221,9 +221,15 @@ public void EveryDocumentedExamplePrintsWhatItSaysItPrints() var wrong = new List(); var offending = new HashSet(); + var run = 0; foreach (var example in Examples()) { var (printed, error) = Run(example.Program, options); + // Each example is a compilation of its own, garbage once it has run, and the collector + // left it standing: alone this test peaked at 2.4 GB, and beside the rest of the suite the + // test host reached 8 GB. Collected every fifth example it peaks at 570 MB, for 3 s more. + if (++run % 5 == 0) + GC.Collect(); if (error is null && printed == example.Prints) continue; offending.Add(example.Member); wrong.Add(error is not null