enricobacis / vim-airline-clock

⏱ vim-airline clock extension - for people that easily loose the sense of time in fullscreen vim sessions
MIT License
56 stars 3 forks source link

windows 10 gvim memory leek #3

Closed zhenlonghe closed 4 years ago

enricobacis commented 6 years ago

Could you be a bit more precise?

Does it always happen? How do you discovered it? Can you reproduce it?

zhenlonghe commented 6 years ago

OK. This issue always happen when I start the gvim on Windows 10 PC. I also test on macOS and Ubuntu, it does not happen.

Thank you for your reply :)

My System Info and My Plugin:


System Information

  Time of this report: 10/20/2017, 08:10:55
         Machine name: HEZHENLONG-PC
     Operating System: Windows 10 Pro 64-bit (10.0, Build 15063) (15063.rs2_release.170317-1834)
             Language: Chinese (Simplified) (Regional Setting: Chinese (Simplified))
  System Manufacturer: LENOVO
         System Model: ThinkCentre M4500t-N000
            Processor: Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz (4 CPUs), ~3.4GHz
               Memory: 4096MB RAM
  Available OS Memory: 4010MB RAM
            Page File: 6280MB used, 5920MB available
          Windows Dir: C:\WINDOWS

Vim Version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 19 2017 09:40:32) MS-Windows 64-bit GUI version with OLE support Included patches: 1-730 Compiled by phmfk@PHMPC Huge version with GUI. Features included (+) or not (-): +acl +ex_extra +multi_byte_ime/dyn -tag_any_white +arabic +extra_search +multi_lang +tcl/dyn +autocmd +farsi -mzscheme -termguicolors +balloon_eval +file_in_path -netbeans_intg -terminal +browse +find_in_path +num64 -tgetent ++builtin_terms +float +ole -termresponse +byte_offset +folding +packages +textobjects +channel -footer +path_extra +timers +cindent +gettext/dyn -perl +title +clientserver -hangul_input +persistent_undo +toolbar +clipboard +iconv/dyn -postscript +user_commands +cmdline_compl +insert_expand +printer +vertsplit +cmdline_hist +job +profile +virtualedit +cmdline_info +jumplist +python/dyn +visual +comments +keymap +python3/dyn +visualextra +conceal +lambda +quickfix +viminfo +cryptv +langmap +reltime +vreplace +cscope +libcall +rightleft +wildignore +cursorbind +linebreak -ruby +wildmenu +cursorshape +lispindent +scrollbind +windows +dialog_con_gui +listcmds +signs +writebackup +diff +localmap +smartindent -xfontset +digraphs +lua/dyn +startuptime -xim +directx +menu +statusline +xpm_w32 -dnd +mksession -sun_workshop -xterm_save -ebcdic +modify_fname +syntax
+emacs_tags +mouse +tag_binary
+eval +mouseshape +tag_old_static
system vimrc file: "$VIM\vimrc" user vimrc file: "$HOME_vimrc" 2nd user vimrc file: "$HOME\vimfiles\vimrc" 3rd user vimrc file: "$VIM_vimrc" user exrc file: "$HOME_exrc" 2nd user exrc file: "$VIM_exrc" system gvimrc file: "$VIM\gvimrc" user gvimrc file: "$HOME_gvimrc" 2nd user gvimrc file: "$HOME\vimfiles\gvimrc" 3rd user gvimrc file: "$VIM_gvimrc" defaults file: "$VIMRUNTIME\defaults.vim" system menu file: "$VIMRUNTIME\menu.vim" Compilation: cl /favor:blend /w -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32
-DFEAT_CSCOPE -DFEAT_JOB_CHANNEL -DFEAT_XPM_W32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 /Fo.\ObjGXOUYHTAMD64/ /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG
/Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DGLOBAL_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -DFEAT_HUGE /Fd.\ObjGXOUYHTAMD64/ /Zi Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib
winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:AMD64 libcmt.lib oleaut32.lib user32.lib
/nodefaultlib:lua53.lib /nodefaultlib:python27.lib /nodefaultlib:python36.lib "C:\Dev\Utils\tcl\lib\tclstu b86.lib" WSock32.lib xpm\x64\lib-vc14\libXpm.lib /PDB:gvim.pdb -debug


Plugins

Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'terryma/vim-multiple-cursors' Plug 'sjl/gundo.vim' Plug 'ctrlpvim/ctrlp.vim' Plug 'tacahiroy/ctrlp-funky' Plug 'majutsushi/tagbar' Plug 'godlygeek/tabular' Plug 'vim-scripts/matchit.zip' Plug 'pelodelfuego/vim-swoop' Plug 'vim-scripts/SearchComplete' Plug 'gaving/vim-sqlcase' Plug 'itchyny/calendar.vim' Plug 'easymotion/vim-easymotion' Plug 'vimwiki/vimwiki' Plug 'luochen1990/rainbow' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdcommenter' Plug 'tpope/vim-surround' Plug 'tpope/vim-ragtag' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' Plug 'ervandew/supertab' Plug 'sirver/ultisnips' | Plug 'honza/vim-snippets' Plug 'vim-scripts/taglist.vim' Plug 'michaeljsmith/vim-indent-object' Plug 'Raimondi/delimitMate' Plug 'kana/vim-repeat' Plug 'vimcn/vimcdoc' Plug 'Shougo/denite.nvim' Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'junegunn/limelight.vim' Plug '~/autocmds' " Colorsheme { Plug 'c9s/colorselector.vim' Plug 'altercation/vim-colors-solarized' Plug 'chriskempson/vim-tomorrow-theme' Plug 'morhetz/gruvbox' Plug 'nanotech/jellybeans.vim' Plug 'tomasr/molokai' Plug 'w0ng/vim-hybrid' Plug 'joshdick/onedark.vim' Plug 'ajh17/Spacegray.vim' "}

zhenlonghe commented 6 years ago

win32 version does not happen, only the high version win64

enricobacis commented 6 years ago

Are you using vim 8?

On Oct 24, 2017 4:09 AM, "zhenlonghe" notifications@github.com wrote:

win32 version does not happen, only the high version win64

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/enricobacis/vim-airline-clock/issues/3#issuecomment-338850276, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIECuTXtiuaRF4B47gG1gw8Xl9nQwR1ks5svUbugaJpZM4P-kMV .

zhenlonghe commented 6 years ago

yep I'm using vim 8.0

enricobacis commented 6 years ago

It might be a problem with timers in general. Could you try to delete everything from line 36?

https://github.com/enricobacis/vim-airline-clock/blob/95d452ec07b12d884b508ba8be686c0f913df6ac/autoload/airline/extensions/clock.vim#L36

On Tue, Oct 24, 2017 at 9:27 AM, zhenlonghe notifications@github.com wrote:

yep I'm using vim 8.0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/enricobacis/vim-airline-clock/issues/3#issuecomment-338899428, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIECvVfYu1ibtjFUG8cm6ZyHo5Uv8hrks5svZFEgaJpZM4P-kMV .

zhenlonghe commented 6 years ago

OK I am having meeting I will try it later.

zhenlonghe commented 6 years ago

Problem has been solved when I detele the code. But the time cannot update in time.

enricobacis commented 6 years ago

I'm wondering if it's a problem with all the timers. Try this:

  1. download this file: https://gist.github.com/enricobacis/1388afcc3abe3e3d9fad556989d824de
  2. open it in vim
  3. :source %
  4. while it's executing (it stops after 10 seconds) check the memory for memory leaks.

On Tue, Oct 24, 2017 at 10:48 AM, zhenlonghe notifications@github.com wrote:

Problem has been solved when I detele the code.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/enricobacis/vim-airline-clock/issues/3#issuecomment-338919689, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIECoMwNLZioT1BUrF87gPL3_VDYhlaks5svaRGgaJpZM4P-kMV .

zhenlonghe commented 6 years ago

I tested as your steps, the issue doesn't happen.

I think the problem maybe refer to the airline#update_statusline function.

enricobacis commented 6 years ago

well, in that case it might be a problem with airline, have you tried running that function multiple times in the timer code I gave you before, without the clock?

On Wed, Oct 25, 2017 at 2:26 AM, zhenlonghe notifications@github.com wrote:

I tested as your steps, the issue doesn't happen.

I think the problem maybe refer to the airline#update_statusline function.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/enricobacis/vim-airline-clock/issues/3#issuecomment-339175843, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIECsaFxzu_WWzHzFSIl5QsvNJI8StSks5svoAjgaJpZM4P-kMV .

oblitum commented 6 years ago

It took me a bit of time to realize I was with a memory leak in my machine. After hours using the PC, it would randomly hard freeze/hang, and I thought it was a hardware issue, because my PC is brand new, except for the SHDD, and the HDD light always got solid red when the freeze happened. I then bought a SSD, installed a new system, a minimalist ArchLinux running Sway/Wayland, and after a week when I started to use it for work, I got the issue again! I've then setup to monitor the machine more carefully and noticed that my tmux session with neovim instances open were taking all the memory as time passed. Another thing worth noticing was that the neovim instances were always taking ~4% CPU usage while idle, and this was what I used to bisect which plugin was busy looping. So it's not only an issue of memory leak, but also of CPU waste. It's also not a Windows only issue, nor neovim only, the same happens on vim.

enricobacis commented 6 years ago

@oblitum thanks for investigating. Have you tried to check if the problem is with timers in general? https://github.com/enricobacis/vim-airline-clock/issues/3#issuecomment-338943050

oblitum commented 6 years ago

@enricobacis I couldn't notice leak or cpu waste by sourcing that file.

oblitum commented 6 years ago

@enricobacis as the issue has been reported happening both on Windows/Linux/NeoVim/Vim, it never happened to you? It's a bit surpring for me. I'm thinking whether it's related to newer Vim/NeoVim versions which we're are using. Except if you're using one of the latest versions too, then I have no idea how you're not reprodicing it.

enricobacis commented 6 years ago

At the moment I'm not using vim-airline, but also before that, my vim sessions are generally short-lived (1-2 hours), so probably that's why I was not reproducing it. The plugin is pretty straightforward and I don't see the memory leak, it might be in the vim-airline plugin management. Feel free to send a PR if you figure things out.

oblitum commented 6 years ago

@enricobacis OK. I've just reported to vim-airline and will simply stop using it for now.

I think it may be worth to warn users in README, it can be really inconvenient.

CptnKirk commented 6 years ago

I have the same issue on Ubuntu 16 and Nvim 0.2.2. This only started happening recently, either correlated to an nvim update to 0.2.2 or recent plugin update (both happened around the same time). On my system, it leaks around 1MB a second. So it is definitely reproducible by watching top -p pid for 30s or so.

load vim-airline, vim-airline-clock and just watch a blank editor buffer.

I'll try and come up with a cut-down vimrc that reproduces.

Seems to be a vim issue with multiple competing timer plugins. vimrc cutdown to reproduce can be found in this issue: https://github.com/neovim/neovim/issues/7871

CptnKirk commented 6 years ago

neovim says it's a plugin problem. Or at least doesn't seem to care unless a plugin can prove the problem is within neovim.

I've narrowed this issue to an interop problem between airline-clock and gitgutter. I don't know how the two can possibly be clashing, but they appear to be.

They also don't appear to be clashing on timers. This is a problem even if I remove gitgutter async support and force it to use synchronous calls. In fact, this is a problem even if I disable the plugin (it is still loaded).

I don't have any insight into either of these plugins. Although, if you stop airline-clock's timer, the memory gets reclaimed. Is it possible that gitgutter is somehow pinning airline memory that isn't being released on every clock tick?

can calls to

call airline#update_statusline()

pile up memory until the timer is killed?

:call timer_stopall()

frees all memory, and this is the only timer running

oblitum commented 6 years ago

@CptnKirk I've never used gitgutter.

oblitum commented 6 years ago

Just for information sake on this issue tracking, as it's shown on https://github.com/neovim/neovim/issues/7871, this should not be a plugin issue.