Closed jbwyatt4 closed 1 day ago
The memory usage feature is just for viewing where the memory is used.
LLVM and Chromium have online indexes (updated nightly or so), you can see if there's one for the kernel: https://clangd.llvm.org/design/remote-index
You can use cgroups to limit memory usage
What command with cgroups would you use to limit memory usage? I would like something that is very automated.
LLVM and Chromium have online indexes (updated nightly or so), you can see if there's one for the kernel: https://clangd.llvm.org/design/remote-index
This talks about project wide indexes, but not the LLVM or Chromium ones. Do you have links to those?
If you are talking about the compile_commands.json you generate it with this:
What command with cgroups would you use to limit memory usage
One-time setup
1) ~/.config/systemd/user/clangd.slice
:
[Slice]
MemoryMax=2G
2) systemctl --user daemon-reload
Then, systemd-run --user --slice=clangd.slice clangd
This talks about project wide indexes, but not the LLVM or Chromium ones. Do you have links to those?
https://linux.clangd-index.chromium.org/, https://clangd-index.llvm.org/
If you are talking about the compile_commands.json
?
To automate this, you can use 'exrc'
- in the kernel repo, create a .nvim.lua
which starts clangd under the slice
Or you could check the cwd when calling vim.lsp.start
and change the cmd
based on that.
You also need to add --pty
to the systemd-run command as the server works over stdio
systemd-run --user --slice=clangd.slice --pty clangd
Thank you @p00f. I went with the clangd.slice option. I did not need to reload the systemd service as it seems to terminate itself when Neovim is not in use for the way my bundle distribution is setup.
There is still one more problem but I will open another issue for it. Closing this issue.
Yes, with --pty
it's like a normal terminal application, it is not backgrounded like a systemd service
Copying and pasting this issue report from this link: https://github.com/nvim-lua/kickstart.nvim/issues/773
Describe the bug To Reproduce
1) Please download the Linux kernel source 2) Build a kernel for the LSP as documented here: https://gitlab.com/jbwyatt4/vim-megarepo/-/blob/main/neo-elk/Workflow.md?ref_type=heads 3) Go to any .c file, the indexer, clangd, may take up to the full system memory (which on my system is 64 gigabytes of ram) and cause an out of memory situation or be killed by an OOM killer.
Desktop
Neovim Version
This has been going on for a while. How do I limit the memory it uses in Neovim? I would to limit the indexer to 2 or 8 gigs of memory. I checked the documentation on memory, but I am not sure of how to use it to limit it. https://clangd.llvm.org/extensions#memory-usage
My config:
https://gitlab.com/jbwyatt4/vim-megarepo/-/blob/dev/neo-elk/init.lua?ref_type=heads