# HG changeset patch # User Bram Moolenaar # Date 1611521105 -3600 # Node ID 7eef048610348dfcf887e2e0e1afc5f61fe65cd0 # Parent 03ab987c442c1d320cc54e6d1c9c1f008536ea69 patch 8.2.2406: Vim9: profiled :def function leaks memory Commit: https://github.com/vim/vim/commit/c05fe07529f10fc32a2086cb44a708520c8d14ce Author: Bram Moolenaar Date: Sun Jan 24 21:30:48 2021 +0100 patch 8.2.2406: Vim9: profiled :def function leaks memory Problem: Vim9: profiled :def function leaks memory. Solution: Delete the profiled instructions. diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2406, +/**/ 2405, /**/ 2404, diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8837,6 +8837,15 @@ delete_def_function_contents(dfunc_T *df VIM_CLEAR(dfunc->df_instr); dfunc->df_instr = NULL; } +#ifdef FEAT_PROFILE + if (dfunc->df_instr_prof != NULL) + { + for (idx = 0; idx < dfunc->df_instr_prof_count; ++idx) + delete_instr(dfunc->df_instr_prof + idx); + VIM_CLEAR(dfunc->df_instr_prof); + dfunc->df_instr_prof = NULL; + } +#endif if (mark_deleted) dfunc->df_deleted = TRUE;