clangd uses a lot of Memory (Up to 2.5Gig on my System). On my 8GIG System I frequently run into OOM situations.
Currently the only solution I have found is to kill clangd once it uses a lot of memory.
clangd has some commandline options that look like they may reduce memory usage. But I have not found a way how to configure them in CLion.
CLion doesn't like limiting its memory via ulimit, but maybe it could be possible to limit memory only for the clangd processes?
Default limit for clangd is 8GB, but you can easily customize it.
CLion offers you a bunch of settings via "registry".
Open Help | Find Action ...
and find for Registry...
. In the registry find clion.clangd.max.memory
and reduce value to 1000. In this case CLion will automatically kill clangd process if it will eat more memory that you specified.
You also can add Clangd Memory Indicator
widget to bottom bar. In the latest CLion version you need to right click on bottom bar and enabled it.
BTW, clangd works only with opened files. So as few files opened in editor as less memory clangd eats. If it's not your case better to submit ticket to CLion tracker, cause 2.5 GB is too much IMHO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With