Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(isolated_declarations): fix potential memory leak (#6622)
`Scope` contains 2 x `FxHashMap`s, which own data outside of the arena. So this data will not be dropped when the allocator is dropped. The scope for this becoming a memory leak in practice is limited for 2 reasons: 1. All `Scope`s except the root one are popped from the stack by the end of traversal. That last scope's hashmaps are always empty, unless there are unresolved references (references to globals). 2. `oxc_allocator::Vec` is currently `Drop`. However, `oxc_allocator::Vec` will cease to be `Drop` in future, at which point this would become a real memory leak. Additionally, it doesn't make sense to store temporary data in the arena, as the arena is intended to hold data that needs to live as long as the AST, which temporary data doesn't.
- Loading branch information