## [Performance] Prevent OOM crashes by implementing LRU garbage collection in AsyncDataTree
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### The Problem
When opening massive workspaces (e.g., mono-repos with 500k+ files) or returning massive search results, expanding the Explorer tree causes the `AsyncDataTree` to materialize hundreds of thousands of nodes in memory.
Even though the DOM is virtualized via `listWidget.ts`, the in-memory metadata for these nodes scales linearly. Eventually, the browser engine exhausts its memory limit and the renderer crashes (**OOM**).
### The Solution
Implement an **LRU (Least Recently Used) cache** and aggressive garbage collection mechanism within `asyncDataTree.ts`.
When the total number of materialized nodes exceeds a safe threshold (e.g., 50,000), nodes that are not currently visible in the viewport and haven't been accessed recently should be:
- Automatically collapsed
- Garbage collected from memory
This ensures scalability and prevents renderer crashes.
Contributor guide
Assessment
This issue has not been assessed yet.