Skip to content
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

/tmp/edg0_# Files Still Taking Up Memory #12288

Open
Alkaid-Benetnash opened this issue May 8, 2024 · 2 comments
Open

/tmp/edg0_# Files Still Taking Up Memory #12288

Alkaid-Benetnash opened this issue May 8, 2024 · 2 comments
Labels
bug enhancement Improvement to an existing feature Language Service Visual Studio Inherited from Visual Studio

Comments

@Alkaid-Benetnash
Copy link

Environment

  • OS and Version: Arch Linux
  • VS Code Version: 1.89.0
  • C/C++ Extension Version: v1.19.9
  • If using SSH remote, specify OS of remote machine: N/A

"Help->About" copied from VSCode

Version: 1.89.0
Commit: b58957e67ee1e712cebf466b995adf4c5307b2bd
Date: 2024-05-01T02:08:25.066Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 6.8.7-arch1-2

Bug Summary and Steps to Reproduce

Bug Summary:
Basically the same as #3633 . A good summary is in #3633 (comment)
Basically there is no way to configure where to store the tmp/edg cache files. And those files can be huge and occupying spaces depending on how the /tmp is mounted.

Steps to reproduce:

  1. Open/Edit C/C++ files, let the language server run.
  2. Run lsof /tmp
  3. Found deleted yet un-closed files occupying a lot of space (consuming memory if /tmp is on tmpfs). Those files are opened by cpptools-srv
  4. Cannot find a configuration in this extension to change those /tmp/edg0_${PID} locations. Note that the C_Cpp.intelliSenseCachePath is not "/tmp", so the edg0 caches are not controlled by this option.

Expected behavior:
Either properly close the deleted/unlinked cache file, or give users an option to use another directory for the edg0 cache.

Another workaround to use mount namespaces to let vscode to use a special /tmp dir. Example:

sudo -E unshare --mount zsh -c "mount --bind ${HOME}/tmp /tmp && su ${USER} -c code "

Configuration and Logs

No customized `c_cpp_properties.json` file.
I do changed a few options to reduce the cache size. This is a workaround not a solution.

    "C_Cpp.references.maxCachedProcesses": 2,
    "C_Cpp.maxCachedProcesses": 2,
    "C_Cpp.intelliSenseCacheSize": 2048,
    "C_Cpp.maxMemory": 2048,
    "C_Cpp.references.maxMemory": 2048,

c_cpp_log_diagnostics.log
c_cpp_language_server_debug.log



### Other Extensions

I don't think this issue is related to other extensions.


### Additional context

_No response_
@sean-mcmanus
Copy link
Collaborator

@Alkaid-Benetnash Those are temp files created by the EDG parser we use. From looking at the code, it looks like you can change the location by setting the TMPDIR environment variable, but I haven't tested that.

@sean-mcmanus sean-mcmanus added enhancement Improvement to an existing feature Visual Studio Inherited from Visual Studio labels May 8, 2024
@Alkaid-Benetnash
Copy link
Author

Thanks for checking the source code. Is that part open sourced? I tried to figure this out myself but couldn't find the EDG related code.
I can also confirm that the TMPDIR env works. Maybe it is better to let the EDG parser follow the intellisense cache dir config. But I am happy with this answer and it should be a good enough workaround for other users who come across this issue.

Feel free to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug enhancement Improvement to an existing feature Language Service Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

2 participants