Rust file watcher cached 6.4M inodes at boot, bloating macOS app RAM to 25 GB
Developers building a local-first macOS file indexer discovered their app was consuming roughly 25 GB of RAM and pinning a CPU core for ten minutes at every launch. The culprit was the notify-debouncer-full Rust crate's default FileIdMap cache, which walks the entire watch root to record file IDs for rename-event stitching — completely bypassing the app's ignore rules. Because the watcher was set to monitor the user's home directory, it stat-ed approximately 6.4 million files and allocated 54 million path entries, including caches and build folders the team had explicitly excluded. Switching the cache mode to NoCache dropped memory usage from 24.8 GB to 1.45 GB, at the cost of losing paired rename events. The team accepted that trade-off because their indexer is idempotent and already runs a reconcile pass that handles unpaired deletes and creates.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in