GeezerVison is showing github.com — eruby filetype plugin leaks memory · Issue #431 · vim-ruby/vim-ruby
eruby filetype plugin leaks memory #431
Description
Invoking filetype detection on eruby buffer results in memory leaking.
Way to reproduce:
- open an eruby file in vim buffer, like
test.erb with following contents
<!DOCTYPE html>
<html>
<body>
</body>
</html>
- make sure filetype plugin is enabled
filetype plugin on
- check vim process resident memory size. Around 21 MB in my case.
- invoke
filetype detect command many times to observe memory grow. I did it with
:for i in range(20)
: filetype detect
:endfor
- check vim process memory again to see the leak. ~ 1.1 GB in my case.
Additional notes:
- it leaks only when
filetype plugin is on. It may be related to filetype detect behavior, quoting from vim docs for filetype-detect:
When filetype detection was off, it will be enabled first, like the "on"
argument was used.
- it does not leak in case of other file types like ruby, python, html. Observed only at eruby.
- Vim 8.2.2891 on x86_64 Linux
- eruby ftplugin - last change 2019 Jan 06
I'm sorry for previous x-report on vim-rails. Now I've been finally able to narrow-down environment state at which reported issue reliably occurs.
Activity
tpope commented on Jun 11, 2021
Unlike with rails.vim, this should be easy enough to narrow down yourself. Start deleting stuff from the bottom of ftplugin/eruby.vim and keep going until the issue goes away. Just make sure you keep let b:did_ftplugin = 1 so that another version of the ftplugin doesn't load.
dunrix commented on Jun 12, 2021
Ok, that was fast, although I'm not learned in vimscript.
The cause of leak was improperly set b:undo_ftplugin for unloading stuff, by omitting concatenation operator.
Found out this bug was already fixed year ago in your repo, however Vim upstream is still out of sync.
Vim issue reporting policy suggests contact authors directly in case of plugins. That's why I came here… 😕
tpope commented on Jun 12, 2021
I remember this bug, but didn't realize it had the potential for an explosive memory leak. We might wanna do the next upstream sync sooner rather than later.
dkearns commented on Jun 13, 2021
Yes, I'll update Bram today.
Reacted by Tim Pope and Noa Bogart
Metadata
Metadata
Development
No branches or pull requestsIssue actions