RaafatTurki / corn.nvim

LSP diagnostics at your corner
104 stars 7 forks source link

fix: disable undo on render buffer to avoid memory build-up #10

Closed Kazy closed 4 months ago

Kazy commented 5 months ago

My understanding is that since the render function writes the full buffer every time to write the new lines to render, the undo log is creating an entry containing basically a full file each time. The memory quickly grows because of that.

A way to test it is to open a buffer with an LSP attached to it, write some invalid syntax on many lines, and simply move the cursor many times on those lines. If you watch the nvim memory usage (watch -d -n 1 "ps -ax -o pid,%mem,command | grep nvim | grep -v grep"), you should see it increase.

RaafatTurki commented 4 months ago

very nice catch, thanks!

Kazy commented 4 months ago

@RaafatTurki thank you for merging ! Just FYI, nvim_buf_set_option is deprecated in favor of nvim_set_option_value.

RaafatTurki commented 4 months ago

Thanks for the heads up, I had it the other way around.