haskell-language-server
haskell-language-server copied to clipboard
High memory usage even on simple completion
Hello. I am using Arch Linux with Neovim and nvim-lspconfig. I came across some issues with the language server. When I edit a simple haskell file, the memory usage of the language server just went up to 1.3G. I mean, is this normal? Please look forward to fix this. I have just 3G of ram and sometimes the server just uses so much memory that it causes a OOM and the system just freezes. Sometimes I have to hard reboot my pc :(.
Steps to reproduce
-- I just typed this in a file
import Data.List
main :: IO()
main = undefined
When providing some basic completions the server used up 1.3G of memory
https://user-images.githubusercontent.com/87596985/164033177-3f45c302-8b28-4a52-a834-cb79f42ce518.mp4
The progress bar at the top right of the screen shows my memory usage.
What version are you using and can you look at the logs to see if there is any information there? (check the troubleshooting docs)
Can you upgrade and try version 1.6? (Although, 1.7 is about to be released) I think there was some completion work done in 1.4, so it possibly may help.
I have upgraded to version 1.6 . But still the issue persists
I followed the steps you showed in your gif, I sat around 200 MB of live bytes with 900 MB heap. You can try passing -j 1
to HLS at start up to force it to use one core, although I'm not sure if it would help or not.
Unfortunately compiling Haskell is a memory intensive operation, when working on a haskell project I routinely push near 5 GB of ram usage by HLS depending on what I'm doing.
Also if this is actually a bug please take a look at HLS logs to see if there is anything out of the ordinary. Starting in 1.6 the logs will display the memory usage by the server.
You can try passing -j 1 to HLS at start up to force it to use one core, although I'm not sure if it would help or not.
Don't do that, HLS needs at least two capabilities otherwise it won't work.
You can try passing -j 1 to HLS at start up to force it to use one core, although I'm not sure if it would help or not.
Don't do that, HLS needs at least two capabilities otherwise it won't work.
I believe this is no longer true, hls-graph
removes this requirement.
You can try passing -j 1 to HLS at start up to force it to use one core, although I'm not sure if it would help or not.
I tried passing -j 1 to HLS but it just stops working completely. Its memory usage dropped down but there was no completions , no redundency checks, nothing.
You can try passing -j 1 to HLS at start up to force it to use one core, although I'm not sure if it would help or not.
I tried passing -j 1 to HLS but it just stops working completely. Its memory usage dropped down but there was no completions , no redundency checks, nothing.
I cannot reproduce this with HLS 1.7.0. How are you passing the parameter?
How many cores do you have anyway? -j1
will only help if you have more than 1.
I just have 2 cores. I cannot upgrade to version 1.7.0 as I have to compile it myself and I am on Arch (it throws various errors when compiling). So I stopped trying to compile and stick to 1.6.0. In the meanwhile I was using ghcid for some of my work. It just provided error reports. It does not provide completion or any of that stuff (It was never made to that). But it works. And I am considering to use it until I can upgrade to version 1.7.0.
How do I build the project statically. I just want to link all the haskell deps to the main executable. I have tried messing around with the stack yaml but no clue how to do it.
I think I am in the same boat as @TonyTomCat01.
Run from VSCode as .ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin//haskell-language-server-9.0.2 --lsp
I get between 1.2-3 GB of RAMs used. Does that look right for simply editing a 14-module stack
project?
I think I am in the same boat as @TonyTomCat01.
Run from VSCode as
.ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin//haskell-language-server-9.0.2 --lsp
I get between 1.2-3 GB of RAMs used. Does that look right for simply editing a 14-modulestack
project?
Depends on how many files you have open at one-time but yes that is not out of the ordinary.
I think I am in the same boat as @TonyTomCat01. Run from VSCode as
.ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin//haskell-language-server-9.0.2 --lsp
I get between 1.2-3 GB of RAMs used. Does that look right for simply editing a 14-modulestack
project?Depends on how many files you have open at one-time but yes that is not out of the ordinary.
I see. Is there any plan to improve the situation?