-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Potential memory leak #50280
Comments
I'm guessing my issue is related to what you're observing? I just reported that issue a few minutes before you. Yeah, it seems there are some performance degradation happening on Visual Studio Code. I have the same habit of yours where I leave VS Code running for long hours. |
Could you please run Open Process Explorer from Command Palette and share with us what process is consuming that much memory? |
@rebornix As I found VS Code to be the memory hog only by closing it, I don't have the process information from before it was closed. Having been open for a few hours this morning, the processes have the following details: I'll leave VS Code open for the remainder of the day and into tomorrow, and will report again then. |
@shadowfacts thanks! If it only happens when you close the window, you can run |
This happening to me these days as well, even the entire OS is freeze. I also tried disable all the extensions, it always suing around 1GB out of the 8GB RAM, which is even worst if I having multiple browser tabs open mostly for web development, |
Did you have a CPU profile? @shawmanz32na I was told that CPU profile dump is more important for tracking down the slowdowns. |
Per @tommai78101 's comment, I'm happy to create a CPU profile, although I have no idea what actions would be appropriate to perform while profiling. My concern is that something is eating memory, and if I know what that thing was so that I could profile it, we wouldn't need to profile it, right? I can take a profile of something mundane, like editing a markdown document, if someone thinks that the profile might magically reveal whatever is gobbling memory. I'll await for further instruction before creating a CPU profile dump. |
@shawmanz32na See middle post with CPU Profiler GIF at #50279 . And try to help out by completing the specified ACTIONs. I'm doing mine. |
@rebornix This issue is still marked as |
EDIT: Just saw you tag someone else. Whoops! I'm guessing you need to do:
|
I've been having similar issues and I think it may be tied to a garbage collection system or open files/handles not being closed/released. I recently upgraded my system from 12 GB to 24 GB of memory and I still frequently end up with ~90% memory usage. Everything excluding VS Code uses ~2 GB(before and after the upgrade) and VS Code uses the remaining 10-20 GB of memory even with no tabs open in VS Code. Getting up to 10-20 GB memory usage usually requires the intellisense databases in the AppData/Roaming/Code/User/workspaceStorage folder to load by briefly opening a file associated with each project in the workspace. Closing the VS Code window or loading a different workspace in the window doing most of the intellisense work will free up ~20GB of memory. The intellisense DBs for each project in my workspace use about 16 GB(See Image Below) on disk when uncompressed. They all share similar includes and there's 24 different DBs at ~740MB each currently. Closing every tab doesn't seem to close down any of the CPP extensions loaded by Code. Waiting until all the significant CPU and HD activity has finished has no noticeable impact on memory usage either. I was able to free up most of that memory by opening a different workspace in the open Code windows that were doing the intellisense work but I'm unfamiliar with what is being unloaded and reloaded by Code when that occurs. |
@OneOfAFewCoders to your specific issue, it looks like a CPP extension issue, I ran into high CPU/memory with CPP extension sometimes, I'll suggest filing issue against https://github.com/Microsoft/vscode-cpptools first for this one. |
@shawmanz32na don't worry too much about the
I'm not an expert with how Windows calculate the memory, @joaomoreno can I have your help on this? |
@bpasero Has a good step list for this, I believe. |
Here is a checklist to find out more about the freeze/slow/crash
Application Data Directory for VS Code:
Application Data Directory for VS Code Insiders:
|
I'm now also running into a serious freeze/memory leak after the 1.24.0 release. I've now run into this at least three times today. This reproduces when building the solution of my C++ project (can be found here, should be relatively straightforward to build). It doesn't seem to always happen, but every time it has happened was while running a build task. I'll try to provide more information as I am able, but here's what I have so far:
I'm not using any command-line arguments when launching |
I ran with VS Code locked up while building the project, but it seemed to resolve on its own after the build completed. Unfortunately I didn't manage to get data from during the event because of the lock-up, but here's
I've attached the log from running |
@aleksijuvani I was also running vscode without my GPU for the past month, but it was disabled from the Bios instead of the flag. I never had memory problems even though I basically never close vscode. But yesterday, I enabled the GPU and I had to reboot my frozen computer 3 times since then, which is why I stumbled upon this issue. It really seems to be related to the GPU. As a sidenote, I initially thought it was related to the "save" function since all 3 crashes happened right when I was saving my work, but it's probably a coincidence since I save very often anyways. |
Yep me too on my two 8GB Fedora machine when opening two vscode instance i now often hit swap and come to a full OS freeze. Dunno how to investigate further though but would be glad to help. |
@focom Just go ahead and complete the checklist provided by @bpasero here: Then post your results as a comment here. To make the checkbox checked and unchecked, see here: https://help.github.com/articles/basic-writing-and-formatting-syntax/#task-lists |
Hi, some time passed, and i recently hit a memory with the latest 1.30.1 So there might be still some cases where it might happen... it was using all of the 16GB ram and kept swapping, which created a LOT of writes on a brand new SSD. What we might have in common: I left a Java debugging session opened. So yea - i also think it's java related. But maybe a generic solution for this problem should be added. For example a "hard crash" of VSCode in case memory hits 99%, so we can at least avoid extensive swapping. |
I too experienced this today, and while troubleshooting I came across this article: https://randomascii.wordpress.com/2018/02/11/zombie-processes-are-eating-your-memory/ Following that tip I enabled the 'handles' column in task manager and found one java.exe process holding about 100 times more handles than number 2 on the list (about 450k). After tracking down that it was a child process of VSCode, I closed one of my windows and witnessed the following drop in RAM consumption: Note that VSCode itself wasn't listed as using more than a couple of hundred megabytes in the process list... I usually leave my computer on for days (or weeks) at a time between reboots, and rarely restart VSCode. Version: 1.30.2 (system setup) |
@tovine can you share the extensions you installed? I wonder if you install any Java extension. You can also run |
@rebornix Here are the list of extensions installed (from |
@tovine Run |
I can't say for sure when (or if) it will happen again, but I will do that. |
This still occurs constantly for me. Anytime I leave VS Code open for more than a day or two, I find myself in this situation. As a matter of fact, I'm in it at this very moment! My list of extensions (from
And the output of
Following @tovine's tip above, I can see that, indeed, there are a lot of handles... If it helps, here's another printout of the information above after closing one of the two windows:
This clearly seems to point at something about vscode's use of java, but I'm not privy to anything more than that. I'll happily open an issue in a different project/repository, I just don't know which of them is appropriate. And even if that's the case, it seems as though VSCode should notice these runaway processes, or at least properly report its usage in the Windows Task Manager. |
It happened again now, here's the output:
That java.exe process running under vscode currently has about 623 400 handles active and total memory usage is 31.2GB, of which only ~9GB is displayed in the list of processes... |
Based on the information provided above, the issue was caused by extensions using Java @tovine you may want to file issues against redhat.vscode-xml @shawmanz32na you may want to file issues against redhat.java |
Issue Type: Bug
I have noticed extremely high memory usage on my machine for the last few days (at least), but couldn't pinpoint the problem from my Windows task manager. Today, I started troubleshooting by closing open applications, one at a time, to see what helped. It just so happened that the first application I closed was VS Code. Suddenly, 8GB of RAM became available. Here's a screenshot:
I can't give you too many more details, except that I often leave VS Code open when I go home from work, and it seems as though the longer it's open, the worse it performs.
To reproduce, launch VS Code, then go have coffee, have lunch, attend and afternoon meeting, go home, come back, do it all again, go home, come back, and look at VS Code's memory usage.
VS Code version: Code 1.23.1 (d0182c3, 2018-05-10T17:11:17.614Z)
OS version: Windows_NT x64 10.0.17134
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled
Extensions (9)
The text was updated successfully, but these errors were encountered: