Skip to content

Possible memory leak related to lldb-mi #10176

Closed as duplicate
Closed as duplicate

Description

@hackroid

Environment

  • OS and version: macOS Ventura 13.0.1 (22A400)
  • VS Code:
    • Version: 1.73.1
    • Commit: 6261075646f055b99068d3688932416f2346dd3b
    • Date: 2022-11-09T02:22:48.959Z
    • Electron: 19.0.17
    • Chromium: 102.0.5005.167
    • Node.js: 16.14.2
    • V8: 10.2.154.15-electron.0
    • OS: Darwin arm64 22.1.0
    • Sandboxed: No
  • C/C++ extension: v1.12.4
  • GDB / LLDB version: lldb-1400.0.38.13, Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)

Bug Summary and Steps to Reproduce

Bug Summary:
lldb-mi kept eating memory (about +500MB/s) when debugging until the whole macOS froze.

Steps to reproduce:

  1. Debug the following snippet with the provided environment above
    #include <iostream>
    #include <vector>
    
    using namespace std;
    
    int main()
    {
        vector<int> nn(4, 0);
        for (size_t i = 0; i < 4; i++) {
            int tt;
            cin >> tt;
            nn[i] = tt;
        }
        vector<int> k;
        cout << nn[1];
        return 0;
    }
  2. With the config(launch/task) provided below
  3. Make a break point at line 14: vector<int> k;
  4. Start debugging
  5. Input 4 integers 5 2 6 1 , press enter, then be like this
    debug
  6. Variables monitor will show nothing but loading...
    var
  7. Open Activity Monitor (macOS app), lldb-mi start using lots of memory
    act
  8. Stop debugging, close the terminal windows, lldb-mi still won't stop and keep eating memory
  9. Can stop lldb-mi only by force quit.

Debugger Configurations

{
    "configurations": [
        {
            "name": "clang++ dbg",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "preLaunchTask": "C/C++: clang++ build active file",
            "logging": { "engineLogging": true, "trace": true, "traceResponse": true }
        }
    ],
    "version": "2.0.0"
}

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Debugger Logs

https://blog.hackroid.com/debug-log.html

Other Extensions

No response

Additional Information

No response

Activity

  1. changed the title [-]Possible memory leak related to lldb-mi[/-] [+]Possible memory leak related to `lldb-mi`[/+] on Nov 21, 2022
  2. hackroid commented on Nov 21, 2022

    @hackroid
    Author

    Small changes to the code will avoid the problem, but, just wondering why.
    Like:
    line 10: move int tt; outside the for loop.
    Or like:
    line 9: change size_t to int.

  3. H-G-Hristov commented on Nov 22, 2022

    @H-G-Hristov

    It's broken. I switched to CodeLLDB for debugging on macOS.

    #9831

  4. bobbrow commented on Nov 23, 2022

    @bobbrow
    Contributor

    Andrew Wang (@WardenGnaw) have you seen this?

  5. WardenGnaw commented on Nov 28, 2022

    @WardenGnaw
    Member

    Yeah, this is due to the external dependency the debugger uses lldb-mi.

  6. zanmato1984 commented on Mar 30, 2023

    @zanmato1984

    Observed the exact same issue, i.e., local variable keep loading, lldb-mi showing significant memory consumption after a while.

    OS

    macOS Ventura Version 13.2.1 (22D68)

    VSCode

    Version: 1.76.2
    Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
    Date: 2023-03-14T17:53:46.528Z
    Electron: 19.1.11
    Chromium: 102.0.5005.196
    Node.js: 16.14.2
    V8: 10.2.154.26-electron.0
    OS: Darwin arm64 22.3.0
    Sandboxed: No

  7. zanmato1984 commented on Mar 30, 2023

    @zanmato1984

    It's broken. I switched to CodeLLDB for debugging on macOS.

    #9831

    This works for me too. Thanks bro!

  8. denniskb commented on Jul 27, 2024

    @denniskb

    Same issue when trying to step through a googletest test case that involves popen(). Stepping through any other code is smooth and leak-free.

  9. feiyehua commented on Nov 25, 2024

    @feiyehua

    macOS 15.2 Beta (24C5089c),
    Version: 1.95.3 (Universal)
    Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
    Date: 2024-11-13T14:50:04.152Z (1 wk ago)
    Electron: 32.2.1
    ElectronBuildId: 10427718
    Chromium: 128.0.6613.186
    Node.js: 20.18.0
    V8: 12.8.374.38-electron.0
    OS: Darwin arm64 24.2.0
    Same problemImage
    80G of memory is crazy, luckily it won't completely froze my system thanks to swap

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions