vim-clap: maple maybe memory leak
Environment (please complete the following information):
- OS: Manjaro Linux 22.0.1
- (Neo)Vim version: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jan 17 2023 16:07:15) Included patches: 1-1211
- vim-clap version: v0.40
Clap debug
has ctags: Universal Ctags 5.9.0 (+json)
has cargo: 0
has maple: /data/node/.vim/plugged/vim-clap/bin/maple
maple info: version 0.1.40 (git v0.40), built for x86_64-unknown-linux-musl by rustc 1.67.0 (fc594f156 2023-01-24).
Current FileType: cpp
Third Party Providers: []
Global Options:
let g:clap#autoload_dir = '/data/node/.vim/plugged/vim-clap/autoload'
let g:clap#popup#display = {'shrink': function('151'), 'open': function('<SNR>93_create_display'), 'width': 76, 'shrink_if_undersize': function('150')}
let g:clap#popup#preview = {'line_count': function('<SNR>92__line_count'), 'show': function('152'), 'hide': function('153'), 'clear': function('154'), 'add_highlight': function('156'), 'ge
t_lines': function('<SNR>92__get_lines'), 'getbufvar': function('<SNR>92__getbufvar'), 'setbufvar_batch': function('<SNR>92__setbufvar_batch'), 'setbufvar': function('<SNR>92__setbufvar'), 'wi
nid': 1371, 'win_is_valid': function('<SNR>92__win_is_valid'), 'goto_win': function('<SNR>92__goto_win'), 'set_syntax': function('155'), 'bufnr': 5}
let g:clap#provider_alias = {'gfiles': 'git_files', 'hist:': 'command_history', 'hist/': 'search_history'}
let g:clap_background_shadow_blend = 50
let g:clap_disable_bottom_top = 0
let g:clap_disable_matches_indicator = v:false
let g:clap_disable_run_rooter = v:true
let g:clap_enable_background_shadow = v:false
let g:clap_enable_debug = v:false
let g:clap_enable_icon = v:true
let g:clap_force_matchfuzzy = v:true
let g:clap_forerunner_status_sign = {'done': '•', 'running': '!', 'using_cache': '*'}
let g:clap_indicator_winid = 1372
let g:clap_insert_mode_only = v:false
let g:clap_layout = {'relative': 'editor'}
let g:clap_multi_selection_warning_silent = 0
let g:clap_no_matches_msg = 'NO MATCHES FOUND'
let g:clap_open_action = {'ctrl-v': 'vsplit', 'ctrl-x': 'split', 'ctrl-t': 'tab split'}
let g:clap_open_preview = 'always'
let g:clap_popup_border = 'rounded'
let g:clap_preview_direction = 'AUTO'
let g:clap_preview_size = 5
let g:clap_providers_relaunch_code = '@@'
let g:clap_search_box_border_style = 'curve'
let g:clap_search_box_border_symbols = {'nil': ['', ''], 'curve': ['', ''], 'arrow': ['', '']}
let g:clap_spinner_winid = 1374
Provider Variables:
let g:clap_provider_coc_blink = [2, 100]
im-clap: Vim(return):E716: Key not present in Dictionary: "args", throwpoint:function <SNR>98_out_cb[6]..clap#client#handle[12]..clap#api#call, line 4
Screenshots

About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 22 (13 by maintainers)
Commits related to this issue
- maple: fix `g:clap.provider.args` api call An error occurred when calling `g:clap.provider.args` from maple but `args` does not exist, which even worse could cause memory leakage. Close #924 — committed to liuchengxu/vim-clap by liuchengxu a year ago
- Fix memory leak of appending the inputs each time The root cause of #924 is that the inputs recorded per session is always appended, which is wrong, we should override the entry accordingly. The bug ... — committed to liuchengxu/vim-clap by liuchengxu a year ago
- maple: fix memory leak caused by the input history recording (#925) * maple: fix `g:clap.provider.args` api call An error occurred when calling `g:clap.provider.args` from maple but `args` does n... — committed to liuchengxu/vim-clap by liuchengxu a year ago
Thanks for confirming it! I have a new commit to fix it properly, the root cause turned out to be the input history recorded per session is appended incorrectly, which should be overridden instead https://github.com/liuchengxu/vim-clap/pull/925/commits/ac9ce40d637f5ba5203898f82783cd7054b82183#diff-805a7da151f2a78fbc1a45ed80b19f09d3846dd33d2c22077cea1ccf4ee52602L103-R104. A few attempts were failed, but we finally find the culprit and make vim-clap generally most robust, thanks for the report and being patient!
This commit https://github.com/liuchengxu/vim-clap/commit/fc641d913759303898b1c898eb330ae9a12486e3 seemingly introduced this regression, I have pushed another commit in #925, please pull it again and rebuild to help confirm if that fixes this issue. @altair-albert
@altair-albert I’m almost sure it’s due to the too many spawned tasks when you open and close the provider frequently in a short time, now I have added the debounce to the initial requests. Unless you are not a human, it should work practically. Please pull the latest commit and have another try, let me know if it doesn’t work for you.
i upload video to here https://imgur.com/a/K8DM601, that still use prebuild binanry.