Patch 8.2.0061

10 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 30, 2019, 1:20:46 PM12/30/19
to vim...@googlegroups.com

Patch 8.2.0061
Problem: The execute stack can grow big and never shrinks.
Solution: Reduce the size in gargage collect.
Files: src/eval.c


*** ../vim-8.2.0060/src/eval.c 2019-12-25 19:33:18.520594684 +0100
--- src/eval.c 2019-12-30 19:12:49.939679473 +0100
***************
*** 3857,3862 ****
--- 3857,3886 ----
garbage_collect_at_exit = FALSE;
}

+ // The execution stack can grow big, limit the size.
+ if (exestack.ga_maxlen - exestack.ga_len > 500)
+ {
+ size_t new_len;
+ char_u *pp;
+ int n;
+
+ // Keep 150% of the current size, with a minimum of the growth size.
+ n = exestack.ga_len / 2;
+ if (n < exestack.ga_growsize)
+ n = exestack.ga_growsize;
+
+ // Don't make it bigger though.
+ if (exestack.ga_len + n < exestack.ga_maxlen)
+ {
+ new_len = exestack.ga_itemsize * (exestack.ga_len + n);
+ pp = vim_realloc(exestack.ga_data, new_len);
+ if (pp == NULL)
+ return FAIL;
+ exestack.ga_maxlen = exestack.ga_len + n;
+ exestack.ga_data = pp;
+ }
+ }
+
// We advance by two because we add one for items referenced through
// previous_funccal.
copyID = get_copyID();
*** ../vim-8.2.0060/src/version.c 2019-12-30 17:55:30.464513273 +0100
--- src/version.c 2019-12-30 18:49:36.393455543 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 61,
/**/

--
5 out of 4 people have trouble with fractions.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages