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:
20
src/vim9.h
20
src/vim9.h
@@ -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
|
||||
};
|
||||
|
Reference in New Issue
Block a user