comparison src/eval.c @ 19001:1ebfb46710cd v8.2.0061

patch 8.2.0061: the execute stack can grow big and never shrinks Commit: https://github.com/vim/vim/commit/3fbcc128cbd2311819cc5a7bb89e45669860f008 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 30 19:19:53 2019 +0100 patch 8.2.0061: the execute stack can grow big and never shrinks Problem: The execute stack can grow big and never shrinks. Solution: Reduce the size in gargage collect.
author Bram Moolenaar <Bram@vim.org>
date Mon, 30 Dec 2019 19:30:03 +0100
parents 24941a950cc7
children d9ea4f0bfd34
comparison
equal deleted inserted replaced
19000:8a0f02d2c9a0 19001:1ebfb46710cd
3855 want_garbage_collect = FALSE; 3855 want_garbage_collect = FALSE;
3856 may_garbage_collect = FALSE; 3856 may_garbage_collect = FALSE;
3857 garbage_collect_at_exit = FALSE; 3857 garbage_collect_at_exit = FALSE;
3858 } 3858 }
3859 3859
3860 // The execution stack can grow big, limit the size.
3861 if (exestack.ga_maxlen - exestack.ga_len > 500)
3862 {
3863 size_t new_len;
3864 char_u *pp;
3865 int n;
3866
3867 // Keep 150% of the current size, with a minimum of the growth size.
3868 n = exestack.ga_len / 2;
3869 if (n < exestack.ga_growsize)
3870 n = exestack.ga_growsize;
3871
3872 // Don't make it bigger though.
3873 if (exestack.ga_len + n < exestack.ga_maxlen)
3874 {
3875 new_len = exestack.ga_itemsize * (exestack.ga_len + n);
3876 pp = vim_realloc(exestack.ga_data, new_len);
3877 if (pp == NULL)
3878 return FAIL;
3879 exestack.ga_maxlen = exestack.ga_len + n;
3880 exestack.ga_data = pp;
3881 }
3882 }
3883
3860 // We advance by two because we add one for items referenced through 3884 // We advance by two because we add one for items referenced through
3861 // previous_funccal. 3885 // previous_funccal.
3862 copyID = get_copyID(); 3886 copyID = get_copyID();
3863 3887
3864 /* 3888 /*