Skip to content

Conversation

@Uanela
Copy link
Collaborator

@Uanela Uanela commented Feb 11, 2026

This PR fixes a critical memory leak issue on Windows where nvim-tree.lua spawns infinite filesystem watchers when the .zig-cache/tmp folder creates temporary files during a build process. The watcher locks these files, preventing Zig from deleting them and causing memory to grow by 10-20 MB/second.

Changes

  1. Added .zig-cache to default ignore_dirs - This directory contains build artifacts not under version control, similar to existing defaults like node_modules and build.

  2. Fixed Windows path handling in ignore_dirs - The forward slash prefix (e.g., /node_modules) used in default ignore patterns wasn't matching Windows paths (e.g., M:\path\to\node_modules). The fix converts forward slashes to backslashes on Windows to ensure proper pattern matching.

Technical Details

The existing utils.escape_special_characters utility was not suitable for this fix as it only handles parentheses and curly braces in paths, not the fundamental path separator difference between Unix (/) and Windows (\).

The solution implements OS-specific path normalization in is_folder_ignored() by converting forward slashes to backslashes on Windows systems before pattern matching with vim.fn.match().

Testing

Tested on Windows 10 with Zig build process. The .zig-cache directory is now properly ignored, and existing defaults like node_modules now correctly match on Windows paths.

Closes #3178

@Uanela Uanela requested a review from alex-courtis February 11, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

filesystem_watchers.ignore_dirs Handle Windows Paths, Add /.zig-cache To Defaults

1 participant