changeset 23729:7eef04861034 v8.2.2406

patch 8.2.2406: Vim9: profiled :def function leaks memory Commit: https://github.com/vim/vim/commit/c05fe07529f10fc32a2086cb44a708520c8d14ce Author: Bram Moolenaar <Bram@vim.org> 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 Jan 2021 21:45:05 +0100
parents 03ab987c442c
children ab57cc57e749
files src/version.c src/vim9compile.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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;