ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.45k stars 2.81k forks source link

Huge memory usage #2630

Closed kovetskiy closed 7 years ago

kovetskiy commented 7 years ago

Issue Details

I've been using YCM for working with big c/cpp project and noticed that ycmd python2 (same as with python3) process is eating more than 1GB RAM after opening 5 files, if 10 files, than 2gb. Issue has reproduced to ycm cpp code base too.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 26 2017 07:49:10)
Included patches: 1-586
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl/dyn
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm     

Output of YcmDebugInfo

-- Client logfile: /tmp/ycm_fj7fibhl.log                                                                               
-- Server Python interpreter: /usr/bin/python2                                                                         
-- Server Python version: 2.7.13                                                                                       
-- Server has Clang support compiled in: True                                                                          
-- Clang version: clang version 4.0.0 (tags/RELEASE_400/final)                                                         
-- Extra configuration file found and loaded                                                                           
-- Extra configuration path: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py      
-- Python completer debug information:                                                                                 
--   JediHTTP running at: http://127.0.0.1:35029                                                                       
--   JediHTTP process ID: 22013                                                                                        
--   JediHTTP executable: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp.py   
--   JediHTTP logfiles:                                                                                                
--     /tmp/jedihttp_35029_stdout_vgmcRR.log                                                                           
--     /tmp/jedihttp_35029_stderr_9TVzZN.log                                                                           
--   Python interpreter: /usr/bin/python2                                                                              
-- Server running at: http://127.0.0.1:38291                                                                           
-- Server process ID: 20588                                                                                            
-- Server logfiles:                                                                                                    
--   /tmp/ycmd_38291_stdout_u64vxawr.log                                                                               
--   /tmp/ycmd_38291_stderr_ge6qwuqr.log                                                                               

Contents of YCM, ycmd and completion engine logfiles

stderr:

2017-04-30 21:25:43,580 - INFO - Received ready request
2017-04-30 21:25:43,642 - INFO - Received event notification
2017-04-30 21:25:43,658 - INFO - Received event notification
2017-04-30 21:25:43,659 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Candidate.cpp
2017-04-30 21:25:43,665 - INFO - Received filetype completion available request
2017-04-30 21:25:49,794 - INFO - Received debug info request
2017-04-30 21:26:18,322 - INFO - Received event notification
2017-04-30 21:26:18,369 - INFO - Received event notification
2017-04-30 21:26:18,371 - INFO - Received event notification
2017-04-30 21:26:18,372 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Candidate.h
2017-04-30 21:26:18,405 - INFO - Received event notification
2017-04-30 21:26:18,435 - INFO - Received event notification
2017-04-30 21:26:18,440 - INFO - Received event notification
2017-04-30 21:26:18,440 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Candidate.h
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:20,864 - INFO - Received event notification
2017-04-30 21:26:20,926 - INFO - Received event notification
2017-04-30 21:26:20,929 - INFO - Received event notification
2017-04-30 21:26:20,929 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Utils.cpp
2017-04-30 21:26:20,963 - INFO - Received event notification
2017-04-30 21:26:20,993 - INFO - Received event notification
2017-04-30 21:26:20,996 - INFO - Received event notification
2017-04-30 21:26:20,997 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Utils.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:22,519 - INFO - Received event notification
2017-04-30 21:26:22,580 - INFO - Received event notification
2017-04-30 21:26:22,582 - INFO - Received event notification
2017-04-30 21:26:22,583 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Result.cpp
2017-04-30 21:26:22,611 - INFO - Received event notification
2017-04-30 21:26:22,643 - INFO - Received event notification
2017-04-30 21:26:22,645 - INFO - Received event notification
2017-04-30 21:26:22,645 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Result.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:25,309 - INFO - Received event notification
2017-04-30 21:26:25,373 - INFO - Received event notification
2017-04-30 21:26:25,376 - INFO - Received event notification
2017-04-30 21:26:25,376 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Utils.cpp
2017-04-30 21:26:25,409 - INFO - Received event notification
2017-04-30 21:26:25,440 - INFO - Received event notification
2017-04-30 21:26:25,444 - INFO - Received event notification
2017-04-30 21:26:25,444 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Utils.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:27,221 - INFO - Received event notification
2017-04-30 21:26:27,264 - INFO - Received event notification
2017-04-30 21:26:27,266 - INFO - Received event notification
2017-04-30 21:26:27,267 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ycm_core.cpp
2017-04-30 21:26:27,293 - INFO - Received event notification
2017-04-30 21:26:27,324 - INFO - Received event notification
2017-04-30 21:26:27,327 - INFO - Received event notification
2017-04-30 21:26:27,327 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ycm_core.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:28,866 - INFO - Received event notification
2017-04-30 21:26:28,911 - INFO - Received event notification
2017-04-30 21:26:28,915 - INFO - Received event notification
2017-04-30 21:26:28,915 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/main.cpp
2017-04-30 21:26:28,949 - INFO - Received event notification
2017-04-30 21:26:28,996 - INFO - Received event notification
2017-04-30 21:26:29,000 - INFO - Received event notification
2017-04-30 21:26:29,001 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/main.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:30,817 - INFO - Received event notification
2017-04-30 21:26:30,872 - INFO - Received event notification
2017-04-30 21:26:30,876 - INFO - Received event notification
2017-04-30 21:26:30,877 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/TestUtils.cpp
2017-04-30 21:26:30,918 - INFO - Received event notification
2017-04-30 21:26:30,972 - INFO - Received event notification
2017-04-30 21:26:30,974 - INFO - Received event notification
2017-04-30 21:26:30,974 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/TestUtils.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:32,485 - INFO - Received event notification
2017-04-30 21:26:32,544 - INFO - Received event notification
2017-04-30 21:26:32,547 - INFO - Received event notification
2017-04-30 21:26:32,547 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/LetterNode.cpp
2017-04-30 21:26:32,591 - INFO - Received event notification
2017-04-30 21:26:32,647 - INFO - Received event notification
2017-04-30 21:26:32,650 - INFO - Received event notification
2017-04-30 21:26:32,650 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/LetterNode.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:34,878 - INFO - Received event notification
2017-04-30 21:26:34,946 - INFO - Received event notification
2017-04-30 21:26:34,949 - INFO - Received event notification
2017-04-30 21:26:34,950 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/TestUtils.cpp
2017-04-30 21:26:34,997 - INFO - Received event notification
2017-04-30 21:26:35,048 - INFO - Received event notification
2017-04-30 21:26:35,054 - INFO - Received event notification
2017-04-30 21:26:35,055 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/TestUtils.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:36,611 - INFO - Received event notification
2017-04-30 21:26:36,656 - INFO - Received event notification
2017-04-30 21:26:36,659 - INFO - Received event notification
2017-04-30 21:26:36,660 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/IndexForLetter_test.cpp
2017-04-30 21:26:36,704 - INFO - Received event notification
2017-04-30 21:26:36,756 - INFO - Received event notification
2017-04-30 21:26:36,759 - INFO - Received event notification
2017-04-30 21:26:36,759 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/IndexForLetter_test.cpp
Traceback (most recent call last):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
    return route.call(**args)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
    rv = callback(*a, **ka)
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 327, in OnFileReadyToParse
    with self._files_being_compiled.GetExclusive( filename ):
  File "/home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 62, in __enter__
    raise RuntimeError( ALREADY_PARSING_MESSAGE )
RuntimeError: File already being parsed.
2017-04-30 21:26:39,504 - INFO - Received event notification
2017-04-30 21:26:39,548 - INFO - Received filetype completion available request
2017-04-30 21:26:39,550 - INFO - Starting JediHTTP server
2017-04-30 21:26:39,553 - INFO - using port 35029
2017-04-30 21:26:39,633 - INFO - Received event notification
2017-04-30 21:26:39,639 - INFO - Received event notification
2017-04-30 21:26:39,641 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/gmock/scripts/upload.py
2017-04-30 21:26:39,668 - INFO - Received event notification
2017-04-30 21:26:39,702 - INFO - Received event notification
2017-04-30 21:26:39,707 - INFO - Received event notification
2017-04-30 21:26:39,709 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/gmock/scripts/upload.py
2017-04-30 21:26:59,169 - INFO - Received debug info request

stdout:

serving on http://127.0.0.1:38291

OS version, distribution, etc.

Arch Linux (rolling release, everything is up to date)

ycm git submodules:

 98712e7d0f6be2a090b6fda2a925f85e63656b58 third_party/requests-futures (98712e7)
 13da3d47255d559308b946242e508d3531dabda5 third_party/ycmd (remotes/origin/auto-5-g13da3d47)

my ycm settings:

    let g:ycm_show_diagnostics_ui = 0
    let g:ycm_confirm_extra_conf = 0
    let g:ycm_key_list_previous_completion=['<UP>']
    let g:ycm_key_list_select_completion=['<DOWN>']

    let g:ycm_collect_identifiers_from_tags_files = 1
    let g:ycm_collect_identifiers_from_comments_and_strings = 1

    let g:ycm_seed_identifiers_with_syntax = 1
    let g:ycm_use_ultisnips_completer = 0

I've tried to disable ycm_collect_identfiers_from_tags and ycm_collect_identifiers_from_comments_and_strings (actually I didn't use tags), but nothing changed.

How I can help to debug the issue? May be provide vim profile log or something else?

vheon commented 7 years ago

Issue has reproduced to ycm cpp code base too.

Can you tell us which file did you try? So we can try ourself and see if we can reproduce. Also do you see this happening as soon as you open the file? Or do you have to do something to see the RAM usage increase?

kovetskiy commented 7 years ago

@vheon see stderr ycm log for messages like:

2017-04-30 21:26:36,759 - INFO - Adding buffer identifiers for file: /home/operator/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/tests/IndexForLetter_test.cpp

YouCompleteMe/third_party/ycmd/cpp/ycm/tests/IndexForLetter_test.cpp

This happening after 2-3 seconds after opening file (seems like ycmd collecting something, may be libclang doing something?), but memory usage does not increases (or just little bit) while editing opened files (moving cursor, writing something for triggering ycm completion).

vheon commented 7 years ago

I'm on mac so I'm not sure if there is something going on with libclang but after opening all the files listed in your stderr and I get a final memory usage of 350Mb. The noticeable bumps are when we load ycm_core.cpp which uses boost::python and when we load tests/main.cpp which uses gmock.h. I didn't dig up further for now though.

ru-wang commented 7 years ago

I have the similar problem here. I also use Arch Linux(kernel 4.9.11). Here is the output of vim --version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 26 2017 07:49:10)
Included patches: 1-586
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl/dyn
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm

After opening 2\~3 files(200\~300 lines for each), the memory usage increases to over 1Gb(after 5~10 files, up to 3Gb). And I find that the memory usage inceases crazily while editing opened files(whether it is a comment line or code line). My project uses Eigen3 and some boost functions, is it because of that?

bstaletic commented 7 years ago

@ru-wang I don't know what's Eigen3, but boost libraries certanly can be heavy and cause that problem. Make an empty main() and include boosts bimap.hpp and see Vim, YCM and everything related slow down to a crawl.

So yes, heavy libraries can cause the issues you're experiencing.

Just for comparison, I'm an Arch user too and I've used YCM with no issues this year to work on bstaletic/eurobot2k17.

ru-wang commented 7 years ago

@bstaletic Thanks for reply. I tried and you are right. Just an empty main() with some boost&Eigen headers makes YCM take up over 700Mb of memory.

BTW, Eigen3 is a header-only template library. So it could be the case that compiling code with template can cause huge usage of RAM.

micbou commented 7 years ago

Duplicate of https://github.com/Valloric/YouCompleteMe/issues/184.

austinwiltshire commented 7 years ago

I don't believe this is a duplicate of #184

184 is about VIM itself consuming too much memory over time.

This issue is about the python2 executable consuming a lot of memory all at once.

xyz1001 commented 7 years ago

I have the same problem

Oranzh commented 6 years ago

I have the same problem. image

austinwiltshire commented 6 years ago

I was able to fix by turning off YCM's integration with tags. My tag file was huge. My impression upon reading other threads is that tags integration for YCM isn't being actively worked on so no optimizations are in sight. If you're seeing this issue, I'd see how large your tag file is and whether or not you've set YCM to pick it up.

Valloric commented 6 years ago

https://github.com/Valloric/ycmd/pull/894 is likely to help with the cases where tags files are huge, since those issues are caused by tons of candidates in the identifier completer and the linked PR reduces the memory consumption per-candidate by 94% (by completely changing the internal architecture in amazing ways).

ghost commented 5 years ago

@Valloric I still get huge java memory usage, 1.13 GB right now with one file open.

bstaletic commented 5 years ago

Who is responsible for memory usage? YCM/ycmd or the java server called jdt.ls? If it's the latter, which is likely, you should talk to jdt devs.