Bram Moolenaar wrote: > Dominique Pelle wrote: > >> I see some valgrind errors when using the ":python" command >> with Vim-7.2.351 on Linux. It happens when using the Python lib >> from Ubuntu-9.10 packages. I then downloaded Python-2.6.4 sources >> from http://www.python.org/download/ and compiled Python myself >> with -O0 -g to have symbols in stack trace. >> >> Doing the following for example gives valgrind errors: >> >> $ cd vim >> $ ./configure --with-features=huge \ >> --enable-pythoninterp \ >> --with-python-config-dir=/usr/local/lib/python2.6/config >> >> $ cd src >> $ valgrind --num-callers=50 \ >> --log-file=vg.log \ >> ./vim -u NONE -U NONE -c ':python a=0' -c ':q' >> >> ... and 'vg.log' contains errors, see: >> http://dominique.pelle.free.fr/valgrind-errors-vim7.2.351-python2.6.4.txt > > I get similar errors. They look like Python errors to me. Not sure if > they are caused by how Vim uses the Python interpreter. > > One of the warnings is about memory used that was freed by realloc(). > That's usually a mistake of using a pointer that points into an area > that grew bigger and was reallocated.
OK, I'll try to look further this weekend. Last time I looked it was unclear to me where to start since the stack in incomplete and possibly incorrect. If I can't figure it out, I might post in a Python mailing list. I suspect that the access to free memory may explain this bug... https://bugs.launchpad.net/ubuntu/+source/vim/+bug/510362 ... since it was reported to happen with a plugin that uses Python (but I have not been able to reproduce this bug myself) >> I'm not sure whether the bug is in Python library or in Vim. >> Unfortunately, some stack traces look wrong: unrolling the stack >> seems to loop so it's difficult to understand where is the problem. >> >> I also see compilation warnings when compiling vim/src/if_python.c: >> >> if_python.c:759: warning: missing initializer >> if_python.c:759: warning: (near initialization for ‘OutputType.tp_getattro’) >> if_python.c:1457: warning: missing initializer >> if_python.c:1457: warning: (near initialization for >> ‘BufferAsSeq.sq_contains’) >> if_python.c:1480: warning: missing initializer >> if_python.c:1480: warning: (near initialization for ‘BufferType.tp_getattro’) >> if_python.c:1699: warning: missing initializer >> if_python.c:1699: warning: (near initialization for ‘RangeAsSeq.sq_contains’) >> if_python.c:1722: warning: missing initializer >> if_python.c:1722: warning: (near initialization for ‘RangeType.tp_getattro’) >> if_python.c:1873: warning: missing initializer >> if_python.c:1873: warning: (near initialization for >> ‘BufListAsSeq.sq_contains’) >> if_python.c:1896: warning: missing initializer >> if_python.c:1896: warning: (near initialization for >> ‘BufListType.tp_getattro’) >> if_python.c:1960: warning: missing initializer >> if_python.c:1960: warning: (near initialization for ‘WindowType.tp_getattro’) >> if_python.c:2195: warning: missing initializer >> if_python.c:2195: warning: (near initialization for >> ‘WinListAsSeq.sq_contains’) >> if_python.c:2218: warning: missing initializer >> if_python.c:2218: warning: (near initialization for >> ‘WinListType.tp_getattro’) >> if_python.c:2280: warning: missing initializer >> if_python.c:2280: warning: (near initialization for >> ‘CurrentType.tp_getattro’) > > I don't get these. Are you using non-default compiler arguments? Ah yes, sorry, I forgot that I changed CFLAGS in src/Makefile. Compiling with gcc flags "-Wall -Wextra" is enough to gives those warnings (CFLAGS = -O0 -g -Wall -Wextra) Cheers -- Dominique -- You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php
