Description
As the title says, nvim-tree is using all my memory in a very particular scenario. I have the following tests inside a C++ application:
#include <filesystem>
int main(int argc, char** argv) {
std::filesystem::path testFolder("testResources");
// TODO: Internal FS
if (std::filesystem::exists(testFolder)) {
std::error_code ec{};
std::filesystem::remove_all(testFolder, ec);
}
if (!std::filesystem::exists(testFolder)) {
std::filesystem::create_directories(testFolder);
}
return 0;
}
(the test above only removes and recreate a directory if you are not used to C++).
when I run it on a folder that has nvim-tree enabled AND filesystem_watchers also enabled, it keeps allocating memory forever. If I disable filesystem_watchers the bug does not trigger. Upon inspection, the nvim-tree.log has the following lines repeated over and over:
[2025-09-02 23:01:51] [watcher] event_cb 'E:\Dev\bin\testResources' 'E:\Dev\bin\testResources'
[2025-09-02 23:01:51] [watcher] node event scheduled refresh explorer:watch:E:\Dev\bin\testResources:14
Neovim version
NVIM v0.11.4
Build type: Release
LuaJIT 2.1.1741730670
Operating system and version
Windows 10
Windows variant
PowerShell
nvim-tree version
321bc61
Clean room replication
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvt-min/site]])
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup({
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing nvim-tree and dependencies.")
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]])
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup({})
end
-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
pattern = "lua",
callback = function()
vim.lsp.start {
name = "my-luals",
cmd = { "lua-language-server" },
root_dir = vim.loop.cwd(),
}
end,
})
]]
Steps to reproduce
- Put >=1 text files on the directory, doesnt matter which size
- Build the C++ application above and also put it on the directory
- nvim -nu nvt-min.lua
- :NvimTreeOpen
- Open any file in the directory
- Run the application 2 or 3 times
- Watch it explode
Expected behavior
No response
Actual behavior
No response
Description
As the title says, nvim-tree is using all my memory in a very particular scenario. I have the following tests inside a C++ application:
(the test above only removes and recreate a directory if you are not used to C++).
when I run it on a folder that has nvim-tree enabled AND filesystem_watchers also enabled, it keeps allocating memory forever. If I disable filesystem_watchers the bug does not trigger. Upon inspection, the nvim-tree.log has the following lines repeated over and over:
Neovim version
Operating system and version
Windows 10
Windows variant
PowerShell
nvim-tree version
321bc61
Clean room replication
Steps to reproduce
Expected behavior
No response
Actual behavior
No response