Garbage collection for orphaned/downgraded module data in LSP
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
To the best of my knowledge once we load a module into the LSP state we do not free it once it has been orphaned.
For example, if we load some dependencies under one environment, and switch the interpreter/environment, we do not free the data for the old environment.
I do not know if we free the AST/answers for files we open outside of the project when we downgrade the requires level, if we for example go-to-def to a file in site packages and then close it.
The process of determining what's orphaned might be expensive so we may not want to do it on every invalidation. Maybe as a periodic background task?
### Sandbox Link
_No response_
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.