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

Transparent Compiler: High memory usage in FSAC #16979

Open
TheAngryByrd opened this issue Apr 2, 2024 · 0 comments · May be fixed by #17543
Open

Transparent Compiler: High memory usage in FSAC #16979

TheAngryByrd opened this issue Apr 2, 2024 · 0 comments · May be fixed by #17543
Labels
Area-FCS Feature Improvement Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Triage-Investigate
Milestone

Comments

@TheAngryByrd
Copy link
Contributor

Please provide a succinct description of the issue.

Using the transparent compiler in FSAC, I've noticed large memory usage. After doing some investigation with dotnet-dump and dotmemory I've found two places that could be better:


The biggest issue stems from re-creating projects for each FSharpCheckFileResults.

projectSnapshot.ToOptions(),

or FSharpCheckProjectResults.

projectSnapshot.ToOptions())

For a large project, this creates thousands of projects for every typecheck. I have a local fork that passes in None instead on the TC side while keeping the BC still passing in Some options. This has an the effect I was looking for but I doubt that's a desirable fix.


Secondly, the size factor in the CompilerCaches isn't publicly configurable. Meaning these checks can stay around in memory for quite a long time.

type internal CompilerCaches(sizeFactor: int) =

let mutable caches = CompilerCaches(100)

For larger projects, being able to change the weakly held and the strongly held references would be ideal.

Expected behavior

Memory usage is ok.

Actual behavior

Chrome isn't scared by much but it's definitely scared by this.

Known workarounds

Custom fork of FCS

Related information

Provide any related information (optional):

  • Operating system
  • .NET Runtime kind (.NET Core, .NET Framework, Mono)
  • Editing Tools (e.g. Visual Studio Version, Visual Studio)
@github-actions github-actions bot added this to the Backlog milestone Apr 2, 2024
@abonie abonie added Area-FCS Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Triage-Investigate Feature Improvement and removed Needs-Triage Bug labels Apr 8, 2024
@TheAngryByrd TheAngryByrd linked a pull request Aug 15, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-FCS Feature Improvement Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Triage-Investigate
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

2 participants