mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
vim-patch:8.2.1905: the wininfo list may contain stale entries (#14884)
Problem: The wininfo list may contain stale entries.
Solution: When closing a window remove any other entry where the window
pointer is NULL.
4882d98339
This commit is contained in:
@@ -166,4 +166,36 @@ describe('memory usage', function()
|
||||
check_result({before=before, after=after, last=last},
|
||||
pcall(ok, last.last < upper))
|
||||
end)
|
||||
|
||||
it('releases memory when closing windows when folds exist', function()
|
||||
local pid = eval('getpid()')
|
||||
source([[
|
||||
new
|
||||
" Insert lines
|
||||
call nvim_buf_set_lines(0, 0, 0, v:false, repeat([''], 999))
|
||||
" Create folds
|
||||
normal! gg
|
||||
for _ in range(500)
|
||||
normal! zfjj
|
||||
endfor
|
||||
]])
|
||||
poke_eventloop()
|
||||
local before = monitor_memory_usage(pid)
|
||||
source([[
|
||||
" Split and close window multiple times
|
||||
for _ in range(1000)
|
||||
split
|
||||
close
|
||||
endfor
|
||||
]])
|
||||
poke_eventloop()
|
||||
local after = monitor_memory_usage(pid)
|
||||
source('bwipe!')
|
||||
poke_eventloop()
|
||||
-- Allow for an increase of 5% in memory usage, which accommodates minor fluctuation,
|
||||
-- but is small enough that if memory were not released (prior to PR #14884), the test
|
||||
-- would fail.
|
||||
local upper = before.last * 1.05
|
||||
check_result({before=before, after=after}, pcall(ok, after.last <= upper))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user