0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0684: Vim9: memory leak when using lambda

Problem:    Vim9: memory leak when using lambda.
Solution:   Move the funccal context to the partial. Free the function when
            exiting.
This commit is contained in:
Bram Moolenaar
2020-05-03 15:38:16 +02:00
parent 5adc55cb74
commit f7779c63d4
7 changed files with 83 additions and 71 deletions

View File

@@ -259,21 +259,6 @@ struct isn_S {
} isn_arg;
};
/*
* Structure to hold the context of a compiled function, used by closures
* defined in that function.
*/
typedef struct funcstack_S
{
garray_T fs_ga; // contains the stack, with:
// - arguments
// - frame
// - local variables
int fs_refcount; // nr of closures referencing this funcstack
int fs_copyID; // for garray_T collection
} funcstack_T;
/*
* Info about a function defined with :def. Used in "def_functions".
*/
@@ -286,11 +271,6 @@ struct dfunc_S {
isn_T *df_instr; // function body to be executed
int df_instr_count;
garray_T *df_ectx_stack; // where compiled closure finds local vars
int df_ectx_frame; // index of function frame in uf_ectx_stack
funcstack_T *df_funcstack; // copy of stack for closure, used after
// closure context function returns
int df_varcount; // number of local variables
int df_closure_count; // number of closures created
};