dotnet / dotnet/vscode-csharp

Language Server Should Garbage Collect in Workstation Mode

Open
#6,499 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Issue description
The language server installs with the default garbage collection in time efficient server mode, as opposed to aggressively memory efficient workstation mode. This causes the language server to consume all available memory. Differential diagnosis is revealed by setting the environment variable `DOTNET_gcServer=0`, which resolves all memory consumption after reloading the user environment.

## Environment data
**VSCode version**: 1.83.0
**C# Extension**: 2.5.30
**Using OmniSharp**: false
```
.NET SDK (reflecting any global.json):
Version: 6.0.414
Commit: dc3b5c4341

Runtime Environment:
OS Name: ubuntu
OS Version: 23.04
OS Platform: Linux
RID: ubuntu.23.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.414/

Host:
Version: 7.0.11
Architecture: x64
Commit: ecb34f85ec

.NET SDKs installed:
6.0.414 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.22 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found
```

## Steps to reproduce
0. Ensure the DotNet 7 runtime is installed in a Linux based OS.
1. Install the CSharp extensions.
2. Open a CSharp project.
3. Enjoy watching all your available memory disappear until your system freezes.

## Expected behavior
As the language server exclusively runs on development workstations its garbage collector can safely default to running in the more aggressively memory efficient workstation mode, to conserve memory resources for other workstation processes.

## Actual behavior
The language server runs in server garbage collection mode, eventually using up all available memory.

## Additional context
Please see the documentation on DotNet garbage collection flavours [here](https://learn.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#flavors-of-garbage-collection).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.