Closed hrodrick closed 1 month ago
Hi @hrodrick,
That seems a bit excessive indeed.
Which version of Unity are you using? How big is your Unity project in terms of C#? How many C# files/csprojs?
Are you generating project files for all your packages? Does this happen if you only generate project files for your in game code, and not for Unity packages?
Thanks!
Interesting, I had literally everything checked on. At a first glance it looks like "Registry Packages" was the main cause. When on, it used 5gb of ram. And "Built-in packages" consumed another 1.3gb. So I disabled everything except embedded packages and local packages. The consumption was around 3.0gb. Is is correct for those packages to consume that much ram?
Now, I was playing a bit more and it seems to be a memory leak somewhere. Look at this video (code at left, ram at right):
https://github.com/microsoft/vscode-dotnettools/assets/26490822/ce9cfe14-f456-4c42-b306-1477253b9d13
I started to write and remove (with ctrl+z) that "GameEvents" line over and over. And the ram usage didn't stop to increase. Whenever I add that line, the "using myProject.myGame" namespace is added to the file, and by removing it with ctrl+z the "using" statement gets removed. But the ram usage doesn't decrease.
Sounds silly but I believe it is actually an issue, because it increased 1.7gb of ram usage by just doing that. (from 3 to 4.7, I realize to record late). And it doesnt go down until I restart VSCode
Sorry I forgot to answer the other questions. My Unity version is 2022.3.21f1 LTS I think the project is small. Considering all the files within the .Assets folder (ie. mine and 3rd party). there is a total of 1856 C# files
Unity's model of having all packages as source means that if you check those, Unity will generate a csproj for each package (and asmdef in those packages). So you end up potentially with 50+ projects, that Roslyn will need to analyze so that you can do code navigation, find references and refactorings across them.
I'll share your video with the C# extension folks.
By any chance, would it be possible to share your project privately so that we could investigate exactly what you're looking at?
If not, could you share the list of Unity packages you're using?
Hi! Sadly I can not share the project. But here is the list of unity packages:
@hrodrick thanks! I can repro the memory just growing. I'll pass that along to the C# team.
I have a large Unity project with 301 projects in Solution. There is a very large memory consumption by the process: Microsoft.VisualStudio.Code.ServiceHost Is this issue related to Microsoft.CodeAnalysis.LanguageServer? The entire memory of the 32Gb working machine goes to VSCode. With the latest update C# v2.39.28 (pre-release) C# Dev Kit v1.9.8 (pre-release) Memory consumption increased even more and it became impossible to work with Unity.
We would need a heap dump of the process(es) consuming excess memory in order to start investigating this issue. I'm not sure how a VS Code user would be expected to complete this, since the "Report Issue" feature of VS Code posts issues publicly.
Had the same issue. It doesn't help if I switch to the pre-release version for c# Dev Kit v1.11.x.
My problem is related to ServiceHost and fixed in C# Dev Kit 1.9.2 and later. https://github.com/microsoft/vscode-dotnettools/issues/1295#issuecomment-2288209777
Closing based on recent comments. Please reopen if this is still an issue with a dump and send it to arkalyan@microsoft.com. I will route it.
Type: Bug
I am working on a unity project. Everything was fine. But suddenly the process "Microsoft.CodeAnalysis.LanguageServer" is taking almost all the ram in my computer. Right now 9764.7 MB are being consumed by it. Becoming almost unusable I see this information in Windows's Task Manager.
As a note, I am not debugging nor doing anything special. This happens right when I open Visual Studio Code. And in the Output I only see a lot of messages of different projecs loaded by C# Dev Kit. It was always like that but it never consumed that amount of memory before.
Extension version: 1.7.25 VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:01:24.262Z) OS version: Windows_NT x64 10.0.22631 Modes:
System Info
|Item|Value| |---|---| |CPUs|AMD Ryzen 9 6900HX with Radeon Graphics (16 x 3294)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.26GB (5.16GB free)| |Process Argv|C:\\Users\\rodri\\Documents\\projects\\games\\MMTD\\Minimalist Multiplayer Tower Defense -g C:\\Users\\rodri\\Documents\\projects\\games\\MMTD\\Minimalist Multiplayer Tower Defense\\Assets\\_project\\Modules\\UI\\UGUI\\SkillTree\\Manager\\SkillTreeManager.cs:1:0 --crash-reporter-id 6ad66de9-4507-4355-865a-fa2299f82af1| |Screen Reader|no| |VM|0%|
A/B Experiments
``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelt:31048053 dsvsc021:30996838 da93g388:31013173 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupytercf:31046870 2f103344:31071589 ```