summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-24 21:30:48 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-24 21:30:48 +0100
commitc05fe07529f10fc32a2086cb44a708520c8d14ce (patch)
tree1f37c1ed97492d11eda2664369798f6c1f3f1dad
parent4efd9948291801bffebf36b4a9910d08ff981987 (diff)
patch 8.2.2406: Vim9: profiled :def function leaks memoryv8.2.2406
Problem: Vim9: profiled :def function leaks memory. Solution: Delete the profiled instructions.
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/src/version.c b/src/version.c
index 136448a352..5153086b02 100644
--- 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
index 9497782ff9..2dd3a4ffec 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -8837,6 +8837,15 @@ delete_def_function_contents(dfunc_T *dfunc, int mark_deleted)
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;