56642Re: BUG: Vim always crashes with some steps
- May 2, 2010Dominique Pelle wrote:
> Bram Moolenaar wrote:Thanks! I'll include it when I have time again.
> > Yukihiro Nakadaira wrote:
> >> Kana Natsuno wrote:
> >> > On Mon, 12 Oct 2009 05:03:27 +0900, Bram Moolenaar <Bram@...=
> > wrote:
> >> >> Can you somehow simplify the way to reproduce this and send me the Vi=
> >> >> script for this?
> >> >
> >> > Sorry, I tried to simplify before reporting but failed. =A0Because the
> >> > problem I encountered seems to depend on the number/order of operation=
> >> > and the problem doesn't occur even if I delete a key/value pair
> >> > expression from dictionary literal which seems not to be related to
> >> > executing scripts.
> >> >
> >> > Anyway, I'll try to simplify again.
> >> Perhaps your problem is ...
> >> In eval.c, all "s:" dictionary is stored in one array (ga_scripts).
> >> When new script file is sourced, the array is re-allocated for new "s:"
> >> dictionary. =A0Then "s:" dictionary, previously assigned to other variab=
> >> (e.g. :let g:foo =3D s:), will become an invalid pointer.
> >> Script to reproduce: (might not crash 100%)
> >> =A0 =A0let script_vars =3D 
> >> =A0 =A0for src in range(10)
> >> =A0 =A0 =A0call writefile(['call add(script_vars, s:)'], src)
> >> =A0 =A0 =A0source `=3Dsrc`
> >> =A0 =A0 =A0" allocate memory to ensure crash.
> >> =A0 =A0 =A0call repeat(' ', 1000)
> >> =A0 =A0endfor
> >> =A0 =A0echo script_vars
> > Very good point. =A0Thanks for finding this problem. =A0I'll think about =
> > solution. =A0Unless someone beats me to it.
> Crash in eval.c described above was reported a long time ago.
> Attached patch fixes it by making ga_scripts in eval.c a growing
> array of pointers "scriptvar_T *" rather than growing array of
> structs "scriptvar_T" so that when ga_scripts is reallocated,
> structures don't move in memory.
> I verified that the sample script given by Yukihiro Nakadaira which
> always caused a crash (and errors with Valgrind) no longer crashes
> after patch (and Valgrind no complain either).
You have heard the saying that if you put a thousand monkeys in a room with a
thousand typewriters and waited long enough, eventually you would have a room
full of dead monkeys.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.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
- << Previous post in topic