Skip to content

Fix for OOM exception while running Analyzer tests on x86 platform - #14328

Merged
Shyam-Gupta merged 3 commits into
mainfrom
dev/shgu/analyzerTests
Feb 26, 2026
Merged

Shyam-Gupta merged 3 commits into
mainfrom
dev/shgu/analyzerTests

Conversation

@Shyam-Gupta

@Shyam-Gupta Shyam-Gupta commented Feb 24, 2026 •

Copy link
Copy Markdown
Member

Issue: Analyzer tests are running into OutOfMemory exceptions on x86 platform. This is because multiple Roslyn compilations are held into memory which causes memory usage to shoot up before GC gets a chance to collect the finalized objects. On x86 the memory space is 2 GB which runs into OOM.

This issue doesn't repro on x64 or when these tests are executed locally in isolation.

Fix: To run GC.Collect after every test execution

Microsoft Reviewers: Open in CodeFlow

…platform. This is because multiple Roslyn compilations are held into memory which causes memory usage to shoot up before GC gets a chance to collect the finalized objects. On x86 the memory space is 2 GB which runs into OOM.

This issue doesn't repro on x64 or when these tests are executed locally in isolation.

Fix: To run GC.Collect after every test iteration.
@Shyam-Gupta
Shyam-Gupta requested a review from a team as a code owner February 24, 2026 23:34
@Shyam-Gupta Shyam-Gupta self-assigned this Feb 24, 2026
@github-actions github-actions Bot added the area-Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. label Feb 24, 2026
@codecov

codecov Bot commented Feb 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.23481%. Comparing base (d65e8b0) to head (5500d63).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14328         +/-   ##
===================================================
- Coverage   77.23556%   77.23481%   -0.00076%     
===================================================
  Files           3279        3280          +1     
  Lines         645107      645112          +5     
  Branches       47731       47731                 
===================================================
- Hits          498252      498251          -1     
- Misses        143161      143164          +3     
- Partials        3694        3697          +3     
Flag Coverage Δ
Debug 77.23481% <100.00000%> (-0.00076%) ⬇️
integration 19.08725% <ø> (-0.00349%) ⬇️
production 52.16521% <ø> (-0.00208%) ⬇️
test 97.41580% <100.00000%> (+0.00003%) ⬆️
unit 49.54868% <ø> (-0.00313%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Shyam-Gupta Shyam-Gupta added the test-enhancement Improvements of test source code label Feb 25, 2026

@KlausLoeffelmann KlausLoeffelmann left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good now. Yay to VB's pretty lister! 😺
And unbelievable quick turn-around - I am getting concerned here! 😉

No, honestly - Copilot or not Copilot: The thing is, one has to have the creativity and the knowledge to ask the right questions and point in the assumed directions. Scary fast turn-around, for that niche a bug. @merriemcgaw, @mcastro-x FYI just because for deserved visibility.

Keep in mind everyone, we are about to throw another 15 - 20 Analyzers in here, which are ready, and are working. But in a Linux docker, under Linux. Totally different platform. Probably never would have crashed or throw OOM. Had I been running into that in that context...I can only hope that my pattern matching would have helped me, so, this is really remarkable and has probably saved us days at least.

@Shyam-Gupta

Copy link
Copy Markdown
Member Author

Thanks Klaus. These changes will certainly help us stabilize the test issues in CI pipeline.

@Shyam-Gupta
Shyam-Gupta merged commit a4d6573 into main Feb 26, 2026
8 checks passed
@Shyam-Gupta
Shyam-Gupta deleted the dev/shgu/analyzerTests branch February 26, 2026 00:09
Shyam-Gupta added a commit that referenced this pull request Feb 26, 2026
…14328)

**Issue**: Analyzer tests are running into OutOfMemory exceptions on x86
platform. This is because multiple Roslyn compilations are held into
memory which causes memory usage to shoot up before GC gets a chance to
collect the finalized objects. On x86 the memory space is 2 GB which
runs into OOM.

This issue doesn't repro on x64 or when these tests are executed locally
in isolation.

**Fix**: To run GC.Collect after every test execution
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/14328)
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. test-enhancement Improvements of test source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants