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.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index a01e27c..fe47513 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -680,13 +680,6 @@
unlet g:Read
enddef
-" TODO: fix memory leak when using same function again.
-def MakeTwoRefs_2()
- let local = ['some']
- g:Extend = {s -> local->add(s)}
- g:Read = {-> local}
-enddef
-
def ReadRef(Ref: func(): list<string>): string
return join(Ref(), ' ')
enddef
@@ -696,7 +689,7 @@
enddef
def Test_closure_two_indirect_refs()
- MakeTwoRefs_2()
+ MakeTwoRefs()
assert_equal('some', ReadRef(g:Read))
ExtendRef(g:Extend, 'more')
assert_equal('some more', ReadRef(g:Read))
@@ -707,4 +700,5 @@
unlet g:Read
enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker