You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cpptools consumes about 6GB memory on debian, and the system get no more response. #5227
I don't know why but it really confused me. Cpptools costs lots of memory, and the debian goes down, but on win10, cpptools works well. The only differece is that the boost libs is installed on debian but not installed on win10. Maybe large scale c++ projects are not supported well? The version of CPPTOOL is 0.27.0-insiders3.
Reacted by Romain Reignier, Joachim Hyrathon, Josh Wong, Idan Pazi, Johannes Meyer, Jonathan Pan, Mikhail Zhuravlev, Andrey Moura, Serhii Korol, Harrison and 5 more
Have you tried 0.27.0-insiders5 (or the soon to be released 0.27.0)? What about 0.26.3 (i.e. is this a regression)?
Do you mean one cpptools process is using 6 GB or do you mean cpptools-srv? Does your system run out of memory after reaching 6 GB, i.e. does it appear like cpptools is requesting > 6 GB and is running out of memory?
The memory is cost by the C/C++ extension, not other applications or processes or services, which is for sure. And version 0.26.3 has been tried, which also has the problem. Once the extension is disabled, everything goes well. I will try the version 0.27, and update a snapshot of the task manager later. If any log is helpful please let me know.
nuaalyy cpptools-srv is part of our extension. Depending on how you're viewing C/C++ extension memory usage, cpptools and multiple cpptools-srv processes could be included in the memory usage count, so it's important for us to know what the per-process memory usage is. Most of our memory usage should be in those processes, but if you're seeing high memory usage in a Visual Studio Code process or "extension host", that would be important to know too.
Santino Keupp (@SantinoKeupp) We are not yet aware of any instability regression in regards to memory usage with 0.27.0 (and we've been in Insider mode for a month). Can you provide more info on what you are seeing?
I tried the latest version, 0.27, same issue. When Find All Reference or Go to Definition, status of cpptools-srv switches to Running, and Memory grows up to even 8GB, and the system hangs. When the cpptools-srv process is killed, system goes back to normal. Wish to be helpful.
This is partly related to #4811 . We spawn up cpptools-srv processes based on the core count without checking the available memory. Both the 2.8 GB cpptools and the 6 GB cpptools-srv are unexpected. Are you aware of anything special about the TU you're compiling, such as using a large file or large libraries?
I was just reviewing the codes, not compiling anything. Indeed, some large libraries is included the project sucn as BOOST, which may be an impact factor.
Is there an open source codebase we can clone to reproduce this error? Unfortunately, there's not much we can do to solve this without some additional help.
kefins Running out of memory is a general symptom for which there could be many causes. We'd need more repro info to determine what the cause is in your case.
kefins Running out of memory is a general symptom for which there could be many causes. We'd need more repro info to determine what the cause is in your case.
I know little about the cpptools process and I don't know how to fix it, if you need more info, you can tell me how to gather them. But I think it was caused by intelliSenseEngine, after making it to be disable, the OOM seems never take place again.
There was mention earlier that the extension uses memory based on quantity of cores. I am running VSCode on a Windows laptop (i5 8GB) connecting remotely to a Raspberry Pi 4 with 2GB RAM and 4 cores. With larger projects the service on the Pi consumes all the available memory over a period of some minutes then it all locks up. There was also mention of disabling some features to make it less memory hungry or running parsers on the local rather than remote machine. Are any of these possible work-arounds for this issue?
The memory usage based on cores is just in regards to the number of IntelliSense processes kept alive. If you're hitting the memory issue with just 1 file then you'd be hitting a different issue. 2-4 GB of RAM may not be enough for using our extension (8+ GB would be recommended). We have some additional settings like C_Cpp.maxCachedProcesses in development (unreleased) that could be used to override that behavior (if you're hitting the issue when opening > 1 file).
sean-mcmanus This problem seems pretty easily reproducible - if not the leak, then just the massive resource usage - have you tested with boost libraries? With a small boost project, with just the editor open, right now I have 5 cpptools-srv processes each taking up 1.2GB of memory. Completely unreasonable.
Update: crashes left a ton of cpptools-srv and cpptools (and code) background processes running. Had to manually kill them all. That left me with one 1.2GB cpptools-srv process in the background. Still seems high... but better.
Michael Behrns-Miller (@moodboom) 1.2 GB memory usage with a file that uses boost sounds "by design" (expected). The preprocessed TU for such a file could be hundreds of thousands of lines long. Implementation of #3628 might solve the issue.
Activity
sean-mcmanus commentedon Mar 30, 2020
Have you tried 0.27.0-insiders5 (or the soon to be released 0.27.0)? What about 0.26.3 (i.e. is this a regression)?
Do you mean one cpptools process is using 6 GB or do you mean cpptools-srv? Does your system run out of memory after reaching 6 GB, i.e. does it appear like cpptools is requesting > 6 GB and is running out of memory?
Does this repro before you open any files?
SantinoKeupp commentedon Mar 31, 2020
I experience similar problems with version 0.27.0 on a gentoo machine. It looks like 0.26.3 is more stable.
nuaalyy commentedon Mar 31, 2020
The memory is cost by the C/C++ extension, not other applications or processes or services, which is for sure. And version 0.26.3 has been tried, which also has the problem. Once the extension is disabled, everything goes well. I will try the version 0.27, and update a snapshot of the task manager later. If any log is helpful please let me know.
sean-mcmanus commentedon Mar 31, 2020
nuaalyy cpptools-srv is part of our extension. Depending on how you're viewing C/C++ extension memory usage, cpptools and multiple cpptools-srv processes could be included in the memory usage count, so it's important for us to know what the per-process memory usage is. Most of our memory usage should be in those processes, but if you're seeing high memory usage in a Visual Studio Code process or "extension host", that would be important to know too.
Santino Keupp (@SantinoKeupp) We are not yet aware of any instability regression in regards to memory usage with 0.27.0 (and we've been in Insider mode for a month). Can you provide more info on what you are seeing?
nuaalyy commentedon Apr 1, 2020
I tried the latest version, 0.27, same issue. When Find All Reference or Go to Definition, status of cpptools-srv switches to Running, and Memory grows up to even 8GB, and the system hangs. When the cpptools-srv process is killed, system goes back to normal. Wish to be helpful.
sean-mcmanus commentedon Apr 1, 2020
This is partly related to #4811 . We spawn up cpptools-srv processes based on the core count without checking the available memory. Both the 2.8 GB cpptools and the 6 GB cpptools-srv are unexpected. Are you aware of anything special about the TU you're compiling, such as using a large file or large libraries?
nuaalyy commentedon Apr 1, 2020
I was just reviewing the codes, not compiling anything. Indeed, some large libraries is included the project sucn as BOOST, which may be an impact factor.
bobbrow commentedon Apr 2, 2020
Is there an open source codebase we can clone to reproduce this error? Unfortunately, there's not much we can do to solve this without some additional help.
47 remaining items
kefins commentedon Jul 12, 2021
I have encountered the same problem, cpptools took too much memory and triggered OOM.
OS version info:
VSCODE version:
C/CPP version:
Version 1.5.1: July 9, 2021 Bug Fixes cppvsdbg Debugging becomes no-op between 1.4.1 and 1.5.0 #7808sean-mcmanus commentedon Jul 13, 2021
kefins Running out of memory is a general symptom for which there could be many causes. We'd need more repro info to determine what the cause is in your case.
kefins commentedon Jul 13, 2021
I know little about the cpptools process and I don't know how to fix it, if you need more info, you can tell me how to gather them. But I think it was caused by intelliSenseEngine, after making it to be disable, the OOM seems never take place again.
sean-mcmanus commentedon Jul 13, 2021
kefins It's best to file a new issue: https://github.com/microsoft/vscode-cpptools/issues/new?assignees=&labels=&template=language-service.md&title= , and mention which process is using the memory and how much memory, what version of the C/C++ extension is being used, what OS is being used, what compiler is being used, and any repro project or file you can provide, and if there are any particular operations that trigger the issue, and a description of how fast the memory accumulates, and potentially a call stack of the process when the memory is increasing quickly (https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv )...some of the C/C++ logging might help (C_Cpp.loggingLevel set to "Debug").
kefins commentedon Jul 13, 2021
Sean McManus (@sean-mcmanus) OK, I will file a new issue later.
github-actions commentedon Oct 1, 2021
Hey Sean McManus (@sean-mcmanus), this issue might need further attention.
nuaalyy, you can help us out by closing this issue if the problem no longer exists, or adding more information.
riban-bw commentedon Oct 2, 2021
There was mention earlier that the extension uses memory based on quantity of cores. I am running VSCode on a Windows laptop (i5 8GB) connecting remotely to a Raspberry Pi 4 with 2GB RAM and 4 cores. With larger projects the service on the Pi consumes all the available memory over a period of some minutes then it all locks up. There was also mention of disabling some features to make it less memory hungry or running parsers on the local rather than remote machine. Are any of these possible work-arounds for this issue?
sean-mcmanus commentedon Oct 4, 2021
The memory usage based on cores is just in regards to the number of IntelliSense processes kept alive. If you're hitting the memory issue with just 1 file then you'd be hitting a different issue. 2-4 GB of RAM may not be enough for using our extension (8+ GB would be recommended). We have some additional settings like C_Cpp.maxCachedProcesses in development (unreleased) that could be used to override that behavior (if you're hitting the issue when opening > 1 file).
fwilmsh commentedon Nov 24, 2021
I'm experiencing a similar issue with memory usage of cpptools process constantly increasing. over about an hour of usage now:


Version of the Cpp Extension is 1.7.1.
I don't have any files exclusions defined.
sean-mcmanus commentedon Nov 29, 2021
Florian Wilmshöver (@fwilmsh) We need more info. Are you able to set the C_Cpp.loggingLevel to "Debug" and check the C/C++ output to determine what is going on when the memory usage is increasing? Or attach a debugger to cpptools to provide a call stack? See https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv
moodboom commentedon Jan 24, 2022
sean-mcmanus This problem seems pretty easily reproducible - if not the leak, then just the massive resource usage - have you tested with boost libraries? With a small boost project, with just the editor open, right now I have 5 cpptools-srv processes each taking up 1.2GB of memory. Completely unreasonable.
Update: crashes left a ton of cpptools-srv and cpptools (and code) background processes running. Had to manually kill them all. That left me with one 1.2GB cpptools-srv process in the background. Still seems high... but better.
sean-mcmanus commentedon Jan 24, 2022
Michael Behrns-Miller (@moodboom) 1.2 GB memory usage with a file that uses boost sounds "by design" (expected). The preprocessed TU for such a file could be hundreds of thousands of lines long. Implementation of #3628 might solve the issue.
github-actions commentedon Mar 26, 2022
This issue has been closed automatically because it needs more information and has not had recent activity.