local v = vim.api
local function popup()
local buf = v.nvim_create_buf(false, true)
for _ = 1,5000 do
local id = v.nvim_open_win(buf, false, {relative = "cursor", width = 5, height = 1, col = 0, row = -1, focusable = false, style = "minimal"})
v.nvim_win_close(id, false)
end
end
Calling this function multiple times will increase execution time with a geometric progression.
Not sure if it is working in the same way if you opening like 25000+ float windows through some neovim session or not.
Can someone confirm this? Neovim bug?
Vim’s popups on the same test working fine.
It looks like for each buffer, we’re going to go through their list of
last wininfos until we find the one corresponding to the current window
and then turn that into null. The comment says that we’re not calling free() on the wininfo in order to be able to re-use its memory, but if
the rest of the code forgets to re-use that memory, the list of
b_wininfo is never going to stop growing.
I don’t know what the proper fix is here as I have zero knowledge of
neovim’s internals, but this issue is probably worth mentionning on
Github :).
wininfo is used to restore local values of window options (and a few more things, like manual folds). I think the approach is to check the code that reads wininfo back (when entering buffer in a new window) and conclude what entries are guaranteed to never been used. Then we can clean these up at in setfpos. I think this would be any NULL entry except for the first one, but it would be good to verify this (we don’t want to make buffer in window state more subtle than it already is)