Christian wrote:

> On Sa, 28 Sep 2019, Bram Moolenaar wrote:
> 
> > 
> > Valgrind has been reporting a leak when running test_popupwin.
> > I narrowed it down to Test_simple_popup(), somewhere halfway.
> > 
> > The valgrind report is:
> > 
> > ==22433== 8 bytes in 1 blocks are definitely lost in loss record 17 of 371
> > ==22433==    at 0x483874F: malloc (in 
> > /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
> > ==22433==    by 0x280E74: lalloc (misc2.c:924)
> > ==22433==    by 0x280D1F: alloc (misc2.c:827)
> > ==22433==    by 0x281395: vim_strsave (misc2.c:1276)
> > ==22433==    by 0x2BAA4A: buf_copy_options (option.c:5848)
> > ==22433==    by 0x1872E4: buflist_new (buffer.c:2116)
> > ==22433==    by 0x2D3AA9: popup_create (popupwin.c:1706)
> > ==22433==    by 0x2D430A: f_popup_create (popupwin.c:1923)
> > 
> > The buf_copy_options() line is:
> > 
> >   buf->b_p_nf = vim_strsave(p_nf);
> > 
> > This is very strange, since several other buffer-local options are
> > allocated, and they are not reported.
> > 
> > I did quite a bit of digging and finally found that this line in
> > defaults.vim triggers it:
> > 
> >     set nrformats-=octal
> > 
> > I tried setting other options there, and got confusing results, until I
> > figured the leak is only reported if the string is exactly 8 bytes! That
> > is 7 text characters plus NUL.  If I change nrformats to only "hex" or
> > make it "hex,hex,hex" then the leak is not reported.
> > 
> > I assume this must be a bug in valgrind.  Can't find anything about it
> > though.
> 
> What version of valgrind are you running? I wonder if we should report 
> this at bugs.kde.org. Is there an easy way to reproduce this?

valgrind-3.14.0

"make test_popupwin" with valgrind enabled in src/testdir/Makefile.
One would have to try out what can be left out without making the
problem disappear.

Dominique wrote:

> It's not impossible to find a bug with valgrind, but I think it's more likely
> to be a real bug with vim.

When I change "set nrformats-=octal" in defaults.vim to something that
is not 8 bytes, then the report goes away.
If I set another buffer-local variable to a value with 8 bytes that
one is also reported.  I don't think Vim itself does something special
for an 8 byte string.


-- 
ARTHUR:  I am your king!
WOMAN:   Well, I didn't vote for you.
ARTHUR:  You don't vote for kings.
WOMAN:   Well, 'ow did you become king then?
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909291225.x8TCPCiJ024028%40masaka.moolenaar.net.

Raspunde prin e-mail lui