Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leak when doing :tcl ::vim::expr 2 #3150

Closed
wants to merge 1 commit into from

Conversation

dpelle
Copy link
Member

@dpelle dpelle commented Jul 3, 2018

This PR fixes a memory leak in vim-8.1.146 and older.
The leak happens as meany times as the :tcl::vim::expr command is invoked.
For example, this will leak 1 block:

$ valgrind --leak-check=full 2> vg.log ./vim --clean -c'tcl ::vim::expr 2+3' -cq

And vg.log contains:

==19619== 2 bytes in 1 blocks are definitely lost in loss record 2 of 169
==19619==    at 0x4C2FDCB: malloc (vg_replace_malloc.c:299)
==19619==    by 0x1FC4C0: lalloc (misc2.c:976)
==19619==    by 0x1FD32D: alloc (misc2.c:874)
==19619==    by 0x1FD32D: vim_strsave (misc2.c:1315)
==19619==    by 0x16273E: eval_to_string (eval.c:844)
==19619==    by 0x2EC8C1: tclvimexpr (if_tcl.c:1384)
==19619==    by 0x663F405: TclNRRunCallbacks (in /usr/lib/x86_64-linux-gnu/libtcl8.6.so)
==19619==    by 0x663FFB9: ??? (in /usr/lib/x86_64-linux-gnu/libtcl8.6.so)
==19619==    by 0x663FA62: Tcl_EvalEx (in /usr/lib/x86_64-linux-gnu/libtcl8.6.so)
==19619==    by 0x6640C64: Tcl_Eval (in /usr/lib/x86_64-linux-gnu/libtcl8.6.so)
==19619==    by 0x2EE97E: ex_tcl (if_tcl.c:1922)
==19619==    by 0x19D191: do_one_cmd (ex_docmd.c:2886)
==19619==    by 0x19D191: do_cmdline (ex_docmd.c:1040)
==19619==    by 0x30416F: exe_commands (main.c:2939)
==19619==    by 0x30416F: vim_main2 (main.c:812)

The leak was found after adding more Tcl tests
in #3140

@codecov-io
Copy link

Codecov Report

Merging #3150 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3150      +/-   ##
==========================================
- Coverage   76.04%   76.04%   -0.01%     
==========================================
  Files          93       93              
  Lines      136733   136734       +1     
==========================================
- Hits       103983   103981       -2     
- Misses      32750    32753       +3
Impacted Files Coverage Δ
src/if_tcl.c 27.06% <0%> (-0.04%) ⬇️
src/gui_gtk_x11.c 48.18% <0%> (-0.15%) ⬇️
src/os_unix.c 57.51% <0%> (-0.1%) ⬇️
src/gui.c 49.48% <0%> (-0.06%) ⬇️
src/message.c 74.83% <0%> (-0.05%) ⬇️
src/ex_docmd.c 77.54% <0%> (-0.02%) ⬇️
src/ex_cmds2.c 82.73% <0%> (+0.09%) ⬆️
src/if_xcmdsrv.c 84.71% <0%> (+0.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0447e8...92cc728. Read the comment docs.

@brammool brammool closed this in 92959fa Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants