Skip to content

Commit c05fe07

Browse files
committed
patch 8.2.2406: Vim9: profiled :def function leaks memory
Problem: Vim9: profiled :def function leaks memory. Solution: Delete the profiled instructions.
1 parent 4efd994 commit c05fe07

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2406,
753755
/**/
754756
2405,
755757
/**/

src/vim9compile.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8837,6 +8837,15 @@ delete_def_function_contents(dfunc_T *dfunc, int mark_deleted)
88378837
VIM_CLEAR(dfunc->df_instr);
88388838
dfunc->df_instr = NULL;
88398839
}
8840+
#ifdef FEAT_PROFILE
8841+
if (dfunc->df_instr_prof != NULL)
8842+
{
8843+
for (idx = 0; idx < dfunc->df_instr_prof_count; ++idx)
8844+
delete_instr(dfunc->df_instr_prof + idx);
8845+
VIM_CLEAR(dfunc->df_instr_prof);
8846+
dfunc->df_instr_prof = NULL;
8847+
}
8848+
#endif
88408849

88418850
if (mark_deleted)
88428851
dfunc->df_deleted = TRUE;

0 commit comments

Comments
 (0)