Open linsmod opened 4 years ago
I have got the same issue.
Windows Pro x64 10.0.18363 WSL OS: Ubuntu 18.04 4.4.0-18362-Microsoft VS Code: 1.45.1 2b65f8a42198f5bc470b28a01fe84ec8788e6adc Extension version: 0.44.2
Yes, me too! And I'm not running tasks that use a lot of memory or cpu
My guess is that Remote WSL for vscode is causing the Linux kernel to cache a lot of files, and then hitting this issue https://github.com/microsoft/WSL/issues/4166
that said, while I see similar behavior on my end, the drop_cache
workaround in there doesn't seem to help much. Only exiting vscode seems to make the RAM usage go back down.
I have got the same issue.
Microsoft Windows [version 10.0.18362.900] WSL OS: Ubuntu 20.04 LTS VS Code: 1.46.1
This is affecting me as well. I guess we should just upvote the OP's post to avoid "me too" comments. (I realise I'm doing the same 😅)
Same here. Too much ram usage like 1161M from htop I can see for the node of vscode server in wsl 2 ubuntu 20.04.
Our problem does not seem to be very urgent to the community ... It's been months now since the first post. Anyone has any news ? Maybe should we post on stackoverflow instead, no ?
Just adding to this that I'm having the same problem.
Development on WSL 2 is becoming more trouble than its worth because of this
WSL 2 forces me to use wsl mode because hot reloading doesn't work in wsl 2 when the files are in the windows system. Then using vs code in wsl remote mode my memory usage is so high.
Still a problem
I found that limiting WSL's RAM usage in .wslconfig helps. I'm assuming the issue isn't really solved but it can avoid RAM usage from ballooning. I have it limited to 1GB with no issues. If you are running a heavy project you could run into issues but I haven't experienced any.
I have configured .wslconfig to limit memory consumption and I utilize the drop_cache
workaround. However, my memory will not be reclaimed without completely shutting down vscode. This is very annoying and makes it not worth developing on windows.
I guess no updates on this ?
The only way I have gotten around this is by limiting the amount of memory wsl uses.
It's not a direct fix but it does stop your wsl from hogging so much memory.
https://medium.com/@lewwybogus/how-to-stop-wsl2-from-hogging-all-your-ram-with-docker-d7846b9c5b37
Updating on my previous comment, at some point the .wslconfig file is essentially ignored as VS Code simply takes all the RAM it wants. My guess is that this issue happens because of WSL rather than VS Code, but VSC still uses too much memory.
My current workaround is to work on my projects via Windows and running a WSL terminal to execute the projects for testing.
I found that limiting the available memory for WSL does not really help, because VS Code apparently still tries to allocate all memory and will get significantly slower after a while. Then the only remedy is restarting VS Code, which I had to do every hour or to be able to keep working.
Personally, I can not recommend using VS Code with WSL 2 as long as this major issue exists. Luckily, it is pretty easy to migrate back to WSL 1. Just run the following from an admin powershell:
wsl --set-version Ubuntu 1
any update ?
same problem running node process inside docker or wsl2. This is causing wsl crashes.
Same problem here, I need to work with 4 VS Code connected on WSL 2 and it costs most part of my RAM.
Any updates?
Same problem here, after a while VS code uses a lot of RAM. VS code studio is not even running! I exited the program but this process is still running. Using WSL 1
Edit : I figured it was because I where using WSL and opened the root directory. I believe it was causing vscode to index all files on my computer thus quickly filling up ram. I solved it by opening a folder with less subfolders
same here, getting vscode node.js process growing to 1.5 GB. I've limited wsl memory so it gets eventually killed by OOM killer, before that WSL is frozen for quite some time, vscode is to be reloaded etc etc. Please fix that bug already.
I may be talking crap, but it seems like VSCode always starts a new WSL instance instead of connecting to an already running one? My windows terminal is set to start a "ubuntu" (lowercase letters) instance, while VS Code seems to start another image (Ubuntu, capitalized):
Running htop
on WSL I can see it's my extensions installed locally on the WSL box that are killing my system. Disabling them it runs fine, I'm guessing some of the extensions I use aren't properly optimised to run on WSL.
Any update on this?
Same here! Any update on this?
The only thing I've been doing is using the .wslconfig
to limit ram and processors
Create one in C:\Users\<user>\.wslconfig
Here's my config below, but you can put this lower if you want less ram to be gobbled up by
[wsl2] memory=6GB # Limits VM memory in WSL2 to 6 GB processors=6 # Makes the WSL2 VM use 6 virtual processors
Hello, is there an update on this issue? I found that limiting the WSL memory is good for preventing the whole system from being unstable. However, I'm seeing myself restarting every few hours because WSL would still eventually run out of memory.
cpu: intel n5105 os: pve 7.2 ct template ubuntu 2204
VS Code remote with ssh is unusable if you use virtual machine as a development environment. Node instances can easily take 2 gigabytes of memory and CPU load is randomly spiking even in casual code and debug session. I think you should have option for ssh remote development without running VSC server for now.
VS Code remote with ssh is unusable if you use virtual machine as a development environment. Node instances can easily take 2 gigabytes of memory and CPU load is randomly spiking even in casual code and debug session. I think you should have option for ssh remote development without running VSC server for now.
Even with the BareMetal development env, I'm also coming up with this issue. Sometimes it steadily eats the memory 20G+, even I've already disconnected and closed vscode in my laptop......
Any configuration could been tuned or workaround for this?
Same here! Any update on this?
I can hang my Amazon EC2.micro instance using vscode SSH extension, the server goes out of memory!
Very similar behaviour to @maicss, system becomes just about unusable at this point.
This has been a dealbreaker for me. I cannot develop on Windows with my VS Code server (WSL2) constantly crashing, and taking up more than half of my 16GB RAM.
I migrated to Pop!_OS Linux because of this, and the developer experience has been wonderful, for 2 months now.
Does anyone have a solution to decrease VS Code's RAM consumption?
Does anyone have a solution to decrease VS Code's RAM consumption?
@harlitad I think the answer is, it depends. You'll have to check what particular component of VSCode is consuming the resources, and then see which configuration options exist for that component, plugin or language you're coding in.
This command will list the different processes that are active remotely on a linux server / WSL (to be run on the remote host). The column 'RSS' will contain the memory in this case:
# output current timestamp, plus the output of ps (only the header row and rows matching .vscode-server).
date && ps -Hylfe | awk 'NR==1 || /.vscode-ser[v]er/'
Then, depending on the item with high memory usage / RSS, optimize your settings so that you don't index and analyze unnecessary items.
Here are some of mine:
settings.json:
"files.watcherExclude": {
"**/.git/objects/**": true, // default
"**/.git/subtree-cache/**": true, // default
"**/.hg/store/**": true, // default
"**/build/**": true,
"**/__pycache__/**": true,
},
"python.analysis.exclude": ["**/node_modules", "**/__pycache__", ".git", "**/build"], // avoid showing duplicates in Ctrl+T etc.
jsconfig.json (in the root folder of a JS project, to ignore irrelevant files):
{
"include": [
"web/js"
]
// "exclude": [
// "node_modules",
// "**/node_modules/*"
// ]
}
// https://code.visualstudio.com/docs/languages/jsconfig
Issue Type: Bug
when open chromium project in remote-wsl after a while , node program in .vscode-server eat memory up to more than 2G
Extension version: 0.44.2 VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T16:36:23.138Z) OS version: Windows_NT x64 10.0.18363 Remote OS version: Linux x64 4.4.0-18362-Microsoft
System Info
|Item|Value| |---|---| |CPUs|AMD Ryzen 7 3700X 8-Core Processor (16 x 3600)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.95GB (1.17GB free)| |Process Argv|D:\chromium\src| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-18.04| |OS|Linux x64 4.4.0-18362-Microsoft| |CPUs|AMD Ryzen 7 3700X 8-Core Processor (16 x 3600)| |Memory (System)|15.95GB (1.17GB free)| |VM|0%|