dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 655 forks source link

Roslyn .NET host takes up a lot of memory (likely background analysis scope related) #6998

Open arkalyanms opened 3 months ago

arkalyanms commented 3 months ago

Refer to https://github.com/microsoft/vscode-dotnettools/issues/518

ShreyasJejurkar commented 3 months ago

Workaround as of now => https://github.com/microsoft/vscode-dotnettools/issues/518#issuecomment-2042059436

rjgotten commented 3 months ago

Workaround as of now => microsoft/vscode-dotnettools#518 (comment)

That's not a workaround for the CPU & memory usage of the Roslyn background analysis though. But a workaround for .NET hosts that are idling and continue to take up RAM, by terminating them rather than leaving them available for reuse.

ShreyasJejurkar commented 3 months ago

That's not a workaround for the CPU & memory usage of the Roslyn background analysis though.

Agreed, that depends upon options configured for background analysis in VSCode.

But this workaround can be used for issues like this. https://github.com/microsoft/vscode-dotnettools/issues/518#issuecomment-1792534901

rjgotten commented 3 months ago

That's not a workaround for the CPU & memory usage of the Roslyn background analysis though.

Agreed, that depends upon options configured for background analysis in VSCode.

But this workaround can be used for issues like this. microsoft/vscode-dotnettools#518 (comment)

No, it can't. I reported that issue because the host in question continued to eat CPU and RAM well into 15 minutes after the system was left idle. The .NET host keeps being tapped for output somehow, so it never idles, so setting that environment variable would not let it shut down either. At worst, it would - and another process would start up immediately after not only giving you the RAM consumption penalty, but also double up on any process spawning and cold-startup costs.

The actual idling hosts don't consume much of anything (and probably have nothing to do with the Roslyn analyzer). It's annoying that they're sticking around in such high volumes, and they're taking up maybe a gig of RAM - but that's pretty much it.

Forcing those to shutdown rather than remain for reuse (though actually not being reused?) won't help with the actual still active host - presumably powering Roslyn - taking up endless CPU and huge amounts of RAM.