4

Vim and especially Gvim stops responding and utilizes 100% of CPU upon opening big .js files (1000+ lines). Pressing Ctrlc stops the process. Whatever Vim does trying to open the file, it displays the file contents—all folded into a single fold—and each character input in insert mode takes minutes to display on the screen. Then I have to restart Vim, to be able to edit the files.

This does not occur everytime, even for the same files, but occurs 3-5 times a day.

Using strace -p PID I see the following messages repeating continuously

poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
...

I've tried with vim --noplugin, yet the same problem occurs. I'm on a Ubuntu 12.04.1 x64 running self compiled Vim. vim :version gives the following info:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 15 2012 17:16:57)
Included patches: 1-631
Huge version with GTK2 GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent    +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind
+cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input
+iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm
+mouse_netterm -mouse_sysmouse +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl +persistent_undo +postscript +printer +profile +python -python3
+quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact
+xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I /usr/include/libpng12   -I/usr/local/include  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L.  -rdynamic -Wl,-export-dynamic  -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl   -ldl     -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions   -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm  -L/usr/lib

Is there anything wrong with my setup? What may be the problem?

0

1 Answer 1

2

Try removing any extra plugins or syntax files you have for editing JS files. A poorly written vimscript or syntax file (basically a bunch of regexes) can make Vim eat all CPU cycles in a blink.

1
  • Thanks, i had totally forgotten of syntax files. And it seems that --noplugin does not affect syntax files. After removing javascript syntax file, Vim and Gvim is way smooth now.
    – altunyurt
    Sep 9, 2012 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.