Skip to content

Commit

Permalink
Fix a memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
olafurpg committed Sep 5, 2024
1 parent b5e4e0f commit f1acdf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vscode/src/tree-sitter/parse-tree-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { type WrappedParser, createParser, getParser } from './parser'

const parseTreesPerFile = new LRUCache<string, Tree>({
max: 10,
// Important: we need to call `Tree.delete()` to free up memory. Without
// this, we leak memory. See CODY-3616.
disposeAfter: tree => tree.delete(),
})

interface ParseTreeCache {
Expand Down

0 comments on commit f1acdf0

Please sign in to comment.