<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/75105>75105</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clangd] large memory leak in 17.0.3
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jswillard
      </td>
    </tr>
</table>

<pre>
    I use clangd from the vscode-clangd extension and noticed a memory leak when I open specific files. Within just a couple minutes clangd will use up 50gb of memory and I get a full system crash shortly thereafter.

I wasn't able to create a simple reproducible but I did find that it has something to do with precompiled headers. If I disable pchs, the issue went away. Also, it only happens when I target iOS, targeting macOS shows no issues.

If there's anything I should look at that would help in investing, lmk. Thanks for you time.

```
"/Users/john/Library/Application Support/Code/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/17.0.3/clangd_17.0.3/bin/clangd" --version
clangd version 17.0.3 (https://github.com/llvm/llvm-project 888437e1b60011b8a375dd30928ec925b448da57)
Features: mac+grpc+xpc
Platform: arm64-apple-darwin23.1.0; target=x86_64-apple-darwin23.1.0
```
```
clang --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```
```
cmake --version
cmake version 3.28.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).
```
```
VSCode
Version: 1.85.0
Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c
Date: 2023-12-06T18:17:50.719Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.1.0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVV1v47YS_TX0y8CESJn6ePBDEl8Dxv3YCyTdFn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