Skip to content

Cpptools consumes about 6GB memory on debian, and the system get no more response. #5227

Closed

Description

@nuaalyy

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.

Activity

  1. sean-mcmanus commented on Mar 30, 2020

    @sean-mcmanus
    Contributor

    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?

  2. added
    more info needed
    on Mar 30, 2020
  3. SantinoKeupp commented on Mar 31, 2020

    @SantinoKeupp

    I experience similar problems with version 0.27.0 on a gentoo machine. It looks like 0.26.3 is more stable.

  4. nuaalyy commented on Mar 31, 2020

    @nuaalyy
    Author

    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.

  5. sean-mcmanus commented on Mar 31, 2020

    @sean-mcmanus
    Contributor

    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?

  6. nuaalyy commented on Apr 1, 2020

    @nuaalyy
    Author

    memory_usage
    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.

  7. sean-mcmanus commented on Apr 1, 2020

    @sean-mcmanus
    Contributor

    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?

  8. nuaalyy commented on Apr 1, 2020

    @nuaalyy
    Author

    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.

  9. added
    investigate: repro
    not reproing
    and removed
    more info needed
    on Apr 1, 2020
  10. bobbrow commented on Apr 2, 2020

    @bobbrow
    Contributor

    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.

  11. added
    more info needed
    on Apr 2, 2020
  12. 47 remaining items

  13. kefins commented on Jul 12, 2021

    @kefins

    I have encountered the same problem, cpptools took too much memory and triggered OOM.

    [Mon Jul 12 15:51:56 2021] Out of memory: Kill process 1631 (cpptools) score 342 or sacrifice child
    [Mon Jul 12 15:51:56 2021] Killed process 1631 (cpptools) total-vm:7280960kB, anon-rss:5549740kB, file-rss:0kB, shmem-rss:0kB
    [Mon Jul 12 15:51:57 2021] oom_reaper: reaped process 1631 (cpptools), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

    OS version info:

     cat /etc/os-release 
    NAME="Ubuntu"
    VERSION="18.04.1 LTS (Bionic Beaver)"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 18.04.1 LTS"
    VERSION_ID="18.04"
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    VERSION_CODENAME=bionic
    UBUNTU_CODENAME=bionic

    VSCODE version:

    版本: 1.58.0 (system setup)
    提交: 2d23c42a936db1c7b3b06f918cde29561cc47cd6
    日期: 2021-07-08T06:54:55.083Z
    Electron: 12.0.13
    Chrome: 89.0.4389.128
    Node.js: 14.16.0
    V8: 8.9.255.25-electron.0
    OS: Windows_NT x64 10.0.19042
    

    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 #7808
  14. sean-mcmanus commented on Jul 13, 2021

    @sean-mcmanus
    Contributor

    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.

  15. kefins commented on Jul 13, 2021

    @kefins

    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.

  16. sean-mcmanus commented on Jul 13, 2021

    @sean-mcmanus
    Contributor

    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").

  17. kefins commented on Jul 13, 2021

    @kefins

    Sean McManus (@sean-mcmanus) OK, I will file a new issue later.

  18. github-actions commented on Oct 1, 2021

    @github-actions

    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.

  19. riban-bw commented on Oct 2, 2021

    @riban-bw

    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?

  20. sean-mcmanus commented on Oct 4, 2021

    @sean-mcmanus
    Contributor

    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).

  21. fwilmsh commented on Nov 24, 2021

    @fwilmsh

    I'm experiencing a similar issue with memory usage of cpptools process constantly increasing. over about an hour of usage now:
    Screenshot from 2021-11-24 15-14-58
    Screenshot from 2021-11-24 15-15-59

    Version of the Cpp Extension is 1.7.1.
    I don't have any files exclusions defined.

  22. sean-mcmanus commented on Nov 29, 2021

    @sean-mcmanus
    Contributor

    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

  23. moodboom commented on Jan 24, 2022

    @moodboom

    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.

  24. sean-mcmanus commented on Jan 24, 2022

    @sean-mcmanus
    Contributor

    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.

  25. github-actions commented on Mar 26, 2022

    @github-actions

    This issue has been closed automatically because it needs more information and has not had recent activity.

  26. locked and limited conversation to collaborators on May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Language Servicebugmore info needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions